这SQL怎么写

tkucn 2011-02-16 11:25:27
update 表1 set IDs="123" where id=最小ID

id为最自动编号

我要更新自动编号最小的记录
...全文
123 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
GameWong 2011-02-16
  • 打赏
  • 举报
回复
update 表1 set IDs="123" where id=(select min(id) from 表1)
快溜 2011-02-16
  • 打赏
  • 举报
回复

update 表1 set IDs="123" where id=(select top 1 id from 表1 order by id)
AcHerat 元老 2011-02-16
  • 打赏
  • 举报
回复
自动编号可以随便改?不怕重复吗?
Sweet-Tang 2011-02-16
  • 打赏
  • 举报
回复
update 表1 set IDs="123" where id=(select MIN(id) from 表1)
飘零一叶 2011-02-16
  • 打赏
  • 举报
回复
update 表1 set IDs="123" where id=(select min(id) from 表1)
haa17 2011-02-16
  • 打赏
  • 举报
回复
+1[Quote=引用 6 楼 sadikaqy 的回复:]

SQL code

update 表1 set IDs="123" where id=(select top 1 id from 表1)
[/Quote]
Rotel-刘志东 2011-02-16
  • 打赏
  • 举报
回复
update 表1 set IDs="123" 
where id=(select min(id) from 表1)
中国风 2011-02-16
  • 打赏
  • 举报
回复
SQL2005以上版本可以這樣用

UPDATE t
SET IDs='123'
FROM (SELECT TOP 1 * FROM 表1 ORDER BY ID)t
sadikaqy 2011-02-16
  • 打赏
  • 举报
回复

update 表1 set IDs="123" where id=(select top 1 id from 表1)

34,590

社区成员

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

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