create table tb(id int,name varchar(10),course int)
insert into tb select 2,'n2',10
insert into tb select 4,'n4',20
insert into tb select 3,'n3',30
insert into tb select 1,'n1',40
insert into tb select 6,'n6',50
insert into tb select 5,'n5',60
select * into c from
(
select name,course from tb order by id
) adrop table tb
drop table c
这里我想把排完序的结果插入c表去 为什么老说order by 的地方有错误呢。去掉就对了。。
insert into tb select 2,'n2',10
insert into tb select 4,'n4',20
insert into tb select 3,'n3',30
insert into tb select 1,'n1',40
insert into tb select 6,'n6',50
insert into tb select 5,'n5',60
select * into c from
(
select name,course from tb order by id
) adrop table tb
drop table c
这里我想把排完序的结果插入c表去 为什么老说order by 的地方有错误呢。去掉就对了。。
select * into c from
(
select top 100 name,course from tb order by id
) a
(
select name,course from tb
) a order by id
from tb
order by id就可以了
(
select TOP 100 Percent name,course from tb order by id
) a
insert into tb select 2,'n2',10
insert into tb select 4,'n4',20
insert into tb select 3,'n3',30
insert into tb select 1,'n1',40
insert into tb select 6,'n6',50
insert into tb select 5,'n5',60select name,course into c from tb order by id drop table tb
drop table c--这样不行吗?