怎么取出数据库中ID号最大的一行记录呢?

wenejiang 2003-02-19 01:43:19
怎么取出数据库中ID号最大的一行记录呢?ID号是一字段
...全文
353 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
j9988 2003-02-19
  • 打赏
  • 举报
回复
select * from table where id in (select max(id) from table)

select a.* from table a,(select max(id) as id from table) b where a.id=b.id
pengdali 2003-02-19
  • 打赏
  • 举报
回复
select top 1 fld1,fld2 from table order by ID desc

哈哈。。up一下
wenejiang 2003-02-19
  • 打赏
  • 举报
回复
我刚给出答案,居然前面有这么多答案了,谢谢各位,再过10分钟就散分了
wenejiang 2003-02-19
  • 打赏
  • 举报
回复
select top 1 fld1,fld2 from table order by ID desc
散分了,up 有分
zqllyh 2003-02-19
  • 打赏
  • 举报
回复
慢了。
zqllyh 2003-02-19
  • 打赏
  • 举报
回复
select top 1 * from table order by id desc
j9988 2003-02-19
  • 打赏
  • 举报
回复
select top 1 * from tab order by id desc

34,590

社区成员

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

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