请问 我想实现 比如
字段名   name  
      test 
      null 
      test 
      null  
      aa 
select * from test group by name
结果为
     test 
     null
      aa 
我想得到的是
      test 
     null
     null
     aa 
如何才能实现?
就是group by 只对非空值分组
  

解决方案 »

  1.   

    搞清楚怎么用group by用法,你那样可以查出来吗?不报错你是高手
      

  2.   

    可以不用group BY 我不知道用什么办法好 
      

  3.   

    那你就UNION ALL
    吧select name from test where name is not null group by name
    union all
    select name from test where name is null;
      

  4.   


    我晕 我的数据库居然不支持union all 我试了下 mysql5是可以的
      

  5.   

    是啊  mysql3.23 公司的一台老的服务器给我管