SQL Server : unsure how to retrieve selected records -
in example, can retrieve rows bb, dd, , ff using t-sql syntax , single select statement?
c1 | c2 | c3 | c4 ----------------- aa | kk | 11 | 99 bb | kk | 11 | 99 cc | kk | 22 | 99 dd | kk | 22 | 99 ee | kk | 33 | 99 ff | kk | 33 | 99
ok, ended solve problem: select distinct [c4], [c1], [c2], [c3] [table] [c4] = 'myvalue' order [c3] desc.
give shot:
select c1, c2, c3, c4 mytable c1 in ('bb', 'dd', 'ff')
if want unique c3 column query should be:
select max(c1), c2, c3, c4 mytable group c2, c3, c4
Comments
Post a Comment