sql server - SQL - How to check for multiple values of one column while only returning one row? -
sorry if question worded weird.
i'm writing report , have table has fields this....
applicationid statusid statuscreationdate 123 1 3-18-2013 123 2 3-27-2013 124 1 3-29-2013 125 1 4-1-2013 125 2 4-3-2013
and want return rows statusid of 1 want check if statusid of 2 exists each applicationid. desired query on above table produce:
123 3-18-2013 125 4-1-2013
any appreciated. if more information needed, let me know. wanted keep short , simple possible while including necessary amount of information.
thanks time.
edit: corrected desired results part
try
select * tablename t statusid = 1 , exists(select * tablename applicationid = t.applicationid , statusid = 2)
Comments
Post a Comment