sql - How to remove certain rows if there are two values for same login id -
loginid status ======================== jo deleted jo active jo discard kir active user1 active user1 deleted the results shoud give me
kir active rest login id should not there.
can plesase query
this should trick:
select * yourtable loginid in (select loginid yourtable group loginid having count([status]) = 1) the having clause ensures loginid values have single status mapped them selected. note query select required rows. if want delete offending rows, can so:
delete yourtable loginid in (select loginid yourtable group loginid having count([status]) > 1)
Comments
Post a Comment