有关数据递增的问题
表A数据
null 1 a1
null 2 a2
.
.
.
.
求一SQL能够得到结果
1 1 a1
2 2 a2
.
.
.
.
[解决办法]
create table AAA(IID int, A varchar(30))
insert into AAA(A) values('aa')
go
insert into AAA(A) values('bb')
go
insert into AAA(A) values('cc')
go
update AAA set IID = (select count(*) from AAA where A < A.A) + 1 from AAA A
go
select * from AAA
go
drop table AAA