求简单SQL语句,号码重复的,最时间最大的记录

xwqjamky 2007-05-09 09:30:27
id sj
1 45
1 65
1 76
2 98
2 65
3 64
4 12
4 25


id 重复的,只取SJ最大的记录
id sj
1 76
2 98
3 64
4 25
...全文
277 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wenyang2004 2007-05-09
  • 打赏
  • 举报
回复
select max(sj) from TABLE1 group by id
hrb2008 2007-05-09
  • 打赏
  • 举报
回复
select id ,max(sj) as sj from tb group by id
bill024 2007-05-09
  • 打赏
  • 举报
回复
select id,max(sj) from t group by id
gahade 2007-05-09
  • 打赏
  • 举报
回复
select id,max(sj) sj from 表 group by id
wwwwb 2007-05-09
  • 打赏
  • 举报
回复
select id,max(sj) from tt group by id
lwl0606 2007-05-09
  • 打赏
  • 举报
回复

select *
from table01 a
where not exists (select 1 from table01 b where a.id=b.id and a.sj<b.sj)

34,588

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧