select dq,bz,count(*) from ( select 'aa' as bz,* from aa union all select 'bb' as bz,* from bb union all select 'cc' as bz,* from cc union all select 'dd' as bz,* from dd ) a group by dq,bz
select 'aa' as tname,count(*) aags from aa where dq like '上海' union all select 'bb' as tname,count(*) aags from bb where dq like '上海' union all select 'cc' as tname,count(*) aags from cc where dq like '上海' union all select 'dd' as tname,count(*) aags from dd where dq like '上海'
谢谢楼上的两位, select 'aa' as tname,count(*) aags from aa where dq like '上海' union all select 'bb' as tname,count(*) aags from bb where dq like '上海' union all select 'cc' as tname,count(*) aags from cc where dq like '上海' union all select 'dd' as tname,count(*) aags from dd where dq like '上海'这样问题解决了; 谢谢·
select 'aa' as bz,* from aa
union all
select 'bb' as bz,* from bb
union all
select 'cc' as bz,* from cc
union all
select 'dd' as bz,* from dd
) a
group by dq,bz
union all
select 'bb' as tname,count(*) aags from bb where dq like '上海'
union all
select 'cc' as tname,count(*) aags from cc where dq like '上海'
union all
select 'dd' as tname,count(*) aags from dd where dq like '上海'
select 'aa' as tname,count(*) aags from aa where dq like '上海'
union all
select 'bb' as tname,count(*) aags from bb where dq like '上海'
union all
select 'cc' as tname,count(*) aags from cc where dq like '上海'
union all
select 'dd' as tname,count(*) aags from dd where dq like '上海'这样问题解决了;
谢谢·