如何让SQL表abc中ID项的数值按照123456.....升序修改

如何让SQL表abc中ID项的数值按照123456.....升序修改,求语句
2025-03-23 20:31:45
推荐回答(3个)
回答1:

select * from tableName order by id asc
应该是这样,主要是 order by 这个关键字。asc是升序,desc是降序。

回答2:

create table test(ID int)
insert into test select 1 union all select 4 union all select 2 union all select 9 union all select 6 union all select 14 union all select 12

select * from test order by ID

不是变成 1,2,3,4,5,6,7,8,9
而是变成 1,2,4,6,9,12,14

如果你要1,2,3,4,5,6,7,8,9那你就需要自增字段了

回答3:

select * from abc order by id