Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
seq Id Status Num
1 321 Pending LK123
2 321 Pending LK123
3 321 Completed LK123
4 456 Pending LK234
5 456 Completed LK456

if status is changed on single num then i want to show only xyz and if status is changed on different Nums the i want to show all

like below
Id Status Num
321 Completed LK123
456 Pending LK234
456 Completed LK456

tq.

What I have tried:

i have showing all (abc , xyz)
Posted
Updated 19-May-18 1:45am
v4
Comments
CHill60 15-May-18 7:45am    
How are you detecting that the status has changed?
Your requirements are not clear. Share your code, it might help us understand
Parazival 15-May-18 8:19am    
Tq for replay.
Status is only 'abc' and 'xyz' that's it like just assume that pending and complete and am displaying all pending and completed like first table that I mentioned in question
CHill60 15-May-18 8:26am    
So you can only tell what the current status is, not that it has changed. It would have been a lot easier to understand if you had actually used "pending" and "completed" instead of 'abc' and 'xyz' by the way.
Your requirements are still not clear. What logic are you using to show the records you are expecting
Parazival 15-May-18 8:46am    
-》 If same Num have pending and complete on same Id then we can directly show 'complete' record(no need to show pending records).

-》 If different Num' S have diff status on same Id then we have to shown all records of that ID

1 solution

See here: Oracle / PLSQL: GROUP BY Clause[^] Use that to gather together all related rows, and to return the MAX Seq value for each group.
You can then use JOIN to fetch only the rows that match that Seq value.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900