22,209
社区成员
发帖
与我相关
我的任务
分享
SELECT Top 1 * from tb WHERE typeid =1 union
SELECT Top 1 * from tb WHERE typeid =2 ORDER BY [value] desc
select
*
from tb As a
Where Not Exists(select 1 From tb As x
Where x.typeid=a.typeid
And x.value>a.value
)
select typeid,Max(value) From tb Group by typeid
select b.* from (select typeid,max(value) value from table group by typeid ) a
left join table b on a.typeid=b.yupeid and a.value=b.value
这个?