22,209
社区成员
发帖
与我相关
我的任务
分享
select top 10 *
from
(select * from table1 where a= 'a1 '
UNION
select * from table2 where b= 'b1 '
UNION...
) AS t1
where id NOT IN
(
SELECT TOP 页大小*(页数-1) id
FROM
(select * from table1 where a= 'a1 '
UNION
select * from table2 where b= 'b1 '
UNION...
) AS t2
ORDER BY id
)
ORDER BY id
你可以做一个视图
create view vv
select * from tb
union all
...........
--分页
select * from vv order by ... limit 从第多少条开始,条数