多表模糊匹配统计查询结果数量

审核中 Mysql 未结 已结 置顶 精帖
删除 置顶 取消置顶 加精 取消加精
66 0
yswl
yswl VIP3 2021-09-04 11:04:53
悬赏:60金币 编辑此贴

多表模糊匹配统计查询结果数量

select sum(a.b) as num from (select count(*) as b from dr_1_news where title like "%出租%" OR keywords like "%出租%" OR content like "%出租%"
union all
select count(*) as b from dr_1_qcp where title like "%出租%" OR keywords like "%出租%" OR content like "%出租%"
union all
select count(*) as b from dr_1_zhuanr where title like "%出租%" OR keywords like "%出租%" OR  content like "%出租%"
union all
select count(*) as b from dr_1_tix where title like "%出租%" OR keywords like "%出租%" OR  content like "%出租%"
union all
select count(*) as b from dr_1_zhin where title like "%出租%" OR keywords like "%出租%" OR  content like "%出租%"
union all
select count(*) as b from dr_1_wend where title like "%出租%" OR keywords like "%出租%" OR  content like "%出租%") AS a


数据库
Mysql 22