select count(*) from View_bidui_report_xh where flag='true' select count(*) from View_bidui_report_xh where department_name='第二组'请问上述两个查询语句能不能合成一个 
就是在查询结果里显示两列

解决方案 »

  1.   

    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 
      

  2.   

    select
    n1=sum(case when flag='true' then 1 else 0 end),
    n2=sum(case when department_name='第二组' then 1 else 0 end) 
    from 
      

  3.   

    select
    (select count(*) from View_bidui_report_xh where flag='true'  ),
    (select count(*) from View_bidui_report_xh where department_name='第二组')
      

  4.   

    js_szy  的不错  楼上 完全看不懂