Anto,
I think I figured out what you are after.
You want only those app_id that ONLY have a seq_id of 1,
Not all of the rows that have seq_id = 1;
with temp1 as (select app_id,max(seq_id) as seq_id from mytable group by app_id) select app_id from temp1 wgere seq_id = 1;
I do not think you can get away from a subselect here.
Andy
Quote:
Originally posted by antodomnic
Noops. This will fetch the records which has the seq_id "2", "3" for the same app_id.
Note that a same app_id contains different seq_id starting from 1 to n.
Now, I need to get all the app_id's which has only "1". If I execute the query,
select * from .. where seq_id=1.
This will fetch all the app_id ie 21,22,23. But I should get only 22 because this is the one satisfy my requirement.
|