?? 分批排序.txt
字號:
/*分批排序*/
/*方法1*/
declare @a table(id int)
declare @b int
select @b=1
while @b<=10
begin
insert into @a select @b
select @b=@b+1
end
--select * from @a
declare @c table(id int)
insert into @c select top 5 * from @a
declare @d table(id int)
insert into @d select * from @c order by id desc
insert into @d select * from @a where id not in (select id from @d)
select * from @d
/*方法2*/
create table #shuzi(id int)
insert into #shuzi select 1
insert into #shuzi select 5
insert into #shuzi select 3
insert into #shuzi select 9
insert into #shuzi select 11
insert into #shuzi select 10
insert into #shuzi select 13
select a.id from ( select top 7 id,sign(id-6) as k ,abs(id-6) as m from #shuzi
order by sign(id-6),abs(id-6) ) a
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -