日期:2014-05-17 浏览次数:20530 次
declare @atb table(a bigint,b bigint)
insert @atb
select 2, 10
union all
select 11 ,30
union all
select 35 ,48
union all
select 49 ,50
union all
select 54 ,70
union all
select 73, 100
select * from @atb
declare @btb table(a bigint,b bigint)
insert @btb
select 1, 8
union all
select 10, 20
union all
select 21 ,30
union all
select 32, 48
union all
select 49 ,50
union all
select 51, 66
union all
select 69 ,100
select * from @btb
declare @atb table(a bigint,b bigint)
insert @atb
select 2, 10
union all
select 11 ,30
union all
select 35 ,48
union all
select 49 ,50
union all
select 54 ,70
union all
select 73, 100
declare @btb table(a bigint,b bigint)
insert @btb
select 1, 8
union all
select 10, 20
union all
select 21 ,30
union all
select 32, 48
union all
select 49 ,50
union all
select 51, 66
union all
select 69 ,100
--SQL:
;WITH
cte1 AS(SELECT num = 1 UNION ALL SELECT 1),