表中添加字段字段值为行编号

来源:互联网 发布:sql to_date 编辑:程序博客网 时间:2024/05/16 05:31

1、查询

set @a=0;

select *, @a:=@a+1 as ID

FROM   table



2、将查询结果另存为一个表

set @a=0;

create table  table1

select *, @a:=@a+1 as ID

FROM   table


0 0
原创粉丝点击