MSSQL的distinct的问题,在线等!

mastermanager 2010-06-30 04:04:52
我现在一个表有字段(id,title,bigclassid,itime),bigclassid是大类的ID号
现在我想查询这个表中一个大类显示一条并按照itime排序,所有字段都要显示出来?

谢过咯!
...全文
92 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
mastermanager 2010-06-30
  • 打赏
  • 举报
回复
xys_777

收到结贴,给分!
谢谢了
永生天地 2010-06-30
  • 打赏
  • 举报
回复
select * from tb t
where id=(select top 1 id from tb where bigclassid=t.bigclassid)
order by itime
Mr_Nice 2010-06-30
  • 打赏
  • 举报
回复
给点儿数据吧
chuifengde 2010-06-30
  • 打赏
  • 举报
回复
select * from [Table] a
where not exists(select 1 from [Table] where bigclassid=a.bigclassid and itime>a.itime)
order by itime

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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