SQL - fetch records based on a condition of two columns -
i need fetch records order no = abc has more 1 tracking number in large table can that?
i'll assume you're fetching records orders
, "large table" trackingnumbers
. can group by
orderno in sub-query , refine sub-query using having
clause. sub-query return orderno
s in table more once. example:
select orderno orders orderno in (select orderno trackingnumbers group orderno having count(*) > 1)
to identify duplicates in single table (as mentioned in comments):
select * orders group trackingnumber having count(*) > 1
Comments
Post a Comment