1,
update a set id=(select count(*) from tb where id<=a.id) from tb a
2,
update a set a.username=b.username from tb a inner join otherTable b on a.id=b.id where a.username=''
1, 恐怕只能自己实现吧, 取出所有的id, 排序,逐条更新
2, 就是关联表吧 update table1 set truename=table2.truename from table1,table2 where table1.username=table2.username ,大体是这样的,你可以查查手册。