create table tabAAA(reser int ,price int )-- select * from tabaaa -- select * from tabBBBselect identity(int,1,1) as id ,* into tabBBB from tabaaaselect id=(select count(reser) from tabbbb where a.reser=tabbbb.reser and tabbbb.id<=a.id) ,* from tabbbb a好象没有一条语句可以做到吧
这里换下 select identity(int,1,1) as id ,* into tabBBB from tabaaa order by reserselect id=(select count(reser) from tabbbb where a.reser=tabbbb.reser and tabbbb.id<=a.id) ,* from tabbbb a order by a.reser
-- select * from tabBBBselect identity(int,1,1) as id ,* into tabBBB from tabaaaselect id=(select count(reser) from tabbbb where a.reser=tabbbb.reser and tabbbb.id<=a.id) ,*
from tabbbb a好象没有一条语句可以做到吧
from tabbbb a
order by a.reser