select count(*) as f from t_family
union
select count(*)as m from t_menu
union
select count(*) as pa from t_parameter
结果显示:(它是自动按大小排序)
1
5
8如果   f = m = 1时:
结果显示:(变成两列)
1

能否..让它查几个...就显示几个 
并不让它自动按大小排序  

解决方案 »

  1.   

    union all 不会去掉重复 语句没有排序, 恰好如此
      

  2.   

    union 会将所有查询到的结果排序,并去掉重复的值.union all只是简单的将查询结果组合在一起显示出来.
      

  3.   

    Select Count(*) From a
    Union
    Select Count(*) From a
    Union
    Select Count(*) From b  COUNT(*)
    ----------
         13002
         13051已经把重复的去掉了阿
      

  4.   

    select count(*) as cnt from t_family
    union 
    select count(*)as cnt  from t_menu
    union 
    select count(*) as cnt  from t_parameter
      

  5.   


    union 会将所有查询到的结果排序,并去掉重复的值.union all只是简单的将查询结果组合在一起显示出来.   这是对的