Re: Query Performance of History Table
Posted by:
X Y
Date: November 27, 2014 02:56AM
I try it with an example:
Lets say we have 5 entries in the history table:
ROW | ID | Ticket_ID | State_ID
1 | 310 | 221 | 1
2 | 311 | 221 | 4
3 | 312 | 221 | 10
4 | 313 | 221 | 2
5 | 314 | 221 | 3
My current query would give me row 3. Because it is the max(ticket_history.id) that matches the state criteria (where state_id in (1, 4, 10, 12, 13)).
Instead I want to always look at the max(ticket_history.id) (row 5 in this case). And than look if it matches my state criteria. If it matches I want to include it in my result, if not i want to leave it out.
So, in this case the information about ticket with ID 221 should be left out completely.
Another Example:
ROW | ID | Ticket_ID | State_ID
1 | 410 | 281 | 2
2 | 411 | 281 | 4
3 | 412 | 281 | 13
4 | 413 | 281 | 2
5 | 414 | 281 | 12
In this scenario I want to add it to my result because the max id matches my state criteria. So information about ticket 281 should be included in my result.
Subject
Written By
Posted
November 24, 2014 07:08AM
November 24, 2014 07:16AM
November 24, 2014 12:33PM
November 26, 2014 08:12AM
November 26, 2014 11:33AM
Re: Query Performance of History Table
November 27, 2014 02:56AM
November 27, 2014 09:19AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.