sql - How to query list of unique records from many to one relationship data structure? -
i having trouble finding suitable query in sql server. have department(table a) having many clients(table b) data structure. looking query retrieve 1 client(first occurrence) of each department client status active. help?
try
select * table1 t1 exists ( select * table2 t2 t1.column1 = t2.column1 , column2 = 1 ) , exists ( select * table2 t2 t1.column1 = t2.column1 , column2 = 2 );
Comments
Post a Comment