create table tb(PId varchar(10),PName varchar(10)) insert into tb select 'A1','电视' union all select 'A6','空调'select [num]=identity(int,300,1),* into # from tb select * from #drop table tb,# --这样?
--如果取出来的结果要想从300开始应该怎么做呢 -- ?? select * from ( Select Num=(select count(*) from 表 where PId+PName<a.PId+a.PName)+1, PId,PName from 表 as a group by PId,PName) x where Num>=300 order by Num
--不知道是不是理解错了 create table tb(PId varchar(10),PName varchar(10)) insert into tb select 'A1','电视' union all select 'A6','空调'select [num]=identity(int,1,1),* into # from tb select * from # where id>=300drop table tb,#
insert into tb select 'A1','电视'
union all select 'A6','空调'select [num]=identity(int,300,1),* into # from tb
select * from #drop table tb,#
--这样?
-- ??
select * from
( Select Num=(select count(*) from 表 where PId+PName<a.PId+a.PName)+1,
PId,PName from 表 as a group by PId,PName) x
where Num>=300 order by Num
create table tb(PId varchar(10),PName varchar(10))
insert into tb select 'A1','电视'
union all select 'A6','空调'select [num]=identity(int,1,1),* into # from tb
select * from # where id>=300drop table tb,#