用Union all 的时候如何取得各个结果集 count数 
这个Union all 是写在函数里的。

解决方案 »

  1.   

    select count(*) from
    (select * from a union all
    select * from b )
      

  2.   

    select count(*) from
    (select 1 as a from a 
    union all
    select 2 as a from b )
    group by a这样应该可以吧1
      

  3.   


    select count(*) from
      (select * from a union all
       select * from b )
     x
      

  4.   

    select cn1 + cn2 from
       (select count(*) cn1 from a),(select count(*) cn2 from b )
      

  5.   

    select count(*) from 
    (select 'X' from tbl1 
    union 
    select 'X' from tbl2 )