有如下表及字段,我想取得这样的结果集,即在C1列的值相同的情况下,取得C2列值最大的那条记录C1 C2 C3 C4
一般 aa
1 2006-10-10 一般 bb
1 2006-10-10 重要 cc
3 2006-9-5 一般 dd
3 2006-9-23 一般 ee
4 2006-9-7 重要 ff
一般 aa
1 2006-10-10 一般 bb
1 2006-10-10 重要 cc
3 2006-9-5 一般 dd
3 2006-9-23 一般 ee
4 2006-9-7 重要 ff
c1
,c2 = select max(c2) from table1 a where a.c1 = b.c1
,c3
,c4
from table1 b
from table1 a
where not exists (
select 1 from table1 b where a.c1 = b.c1 and a.c2 > b.c2)