请教如何写这个SQL语句?

aju 2000-07-30 07:52:00
一个SQL TABLE,几个字段,其中有一个时间字段Time,ID字段ID.
我要SELECT 出最近的10个记录,但是ID要不同。
...全文
155 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
gawj 2000-08-06
  • 打赏
  • 举报
回复
select top 10 * from table order by time desc
zt 2000-08-01
  • 打赏
  • 举报
回复
oralce的方法好象不行,关键在于where rownum<10
以下方法你实验一下:
select top 10 from table order by time desc
XiaoYang 2000-07-31
  • 打赏
  • 举报
回复
oralce:
select time from table where id in(select distinct id from table where rownum<10) order by time;
LaoZheng 2000-07-31
  • 打赏
  • 举报
回复
你的Id有重复,不行吧?

34,576

社区成员

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

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