sflbh sj sl
050102 0 4.00
060101 0 1.00
050102 7 4.00
050102 11 2.00
050102 12 5.00
050102 13 2.00
050102 14 1.00
050102 16 1.00
060101 16 1.00
050102 20 2.00
060101 20 1.00
050102 23 4.00
我想根据sflbh求出sl最大值 同时还列出sj列怎么写?
select sflbh,max(sl) from table
group by sflbh 然后需要对应的sj列
------解决方案--------------------
select
*
from
TB t
where
not exists(select 1 from TB where sflbh=t.sflbh and sl>t.sl)