不知道你的a,b两表有没有关联,假定没有关联
select count(1)
from
(
select id
from a
where id>5
union all
select id
from b
where id>5
)
select xxx as a,xxx as b,xxx as c from tbl_a
union
select xxx as a,xxx as b,xxx as c from tbl_b保证字段名相同,不够的用字符串顶替就OK了
select * from a where id>5
union all
select * from b where id>5
select count(1)
from
(
select id
from a
where id>5
union all
select id
from b
where id>5
)
AS `表名`