select count(*) from View_bidui_report_xh where flag='true' select count(*) from View_bidui_report_xh where department_name='第二组'请问上述两个查询语句能不能合成一个 就是在查询结果里显示两列
select distinct n1=(select count(*) from View_bidui_report_xh where flag='true' ), n2=(select count(*) from View_bidui_report_xh where department_name='第二组') from View_bidui_report_xh
select n1=sum(case when flag='true' then 1 else 0 end), n2=sum(case when department_name='第二组' then 1 else 0 end) from
select (select count(*) from View_bidui_report_xh where flag='true' ), (select count(*) from View_bidui_report_xh where department_name='第二组')
n2=(select count(*) from View_bidui_report_xh where department_name='第二组')
from View_bidui_report_xh
n1=sum(case when flag='true' then 1 else 0 end),
n2=sum(case when department_name='第二组' then 1 else 0 end)
from
(select count(*) from View_bidui_report_xh where flag='true' ),
(select count(*) from View_bidui_report_xh where department_name='第二组')