请问 我想实现 比如
字段名 name
test
null
test
null
aa
select * from test group by name
结果为
test
null
aa
我想得到的是
test
null
null
aa
如何才能实现?
就是group by 只对非空值分组
字段名 name
test
null
test
null
aa
select * from test group by name
结果为
test
null
aa
我想得到的是
test
null
null
aa
如何才能实现?
就是group by 只对非空值分组
吧select name from test where name is not null group by name
union all
select name from test where name is null;
我晕 我的数据库居然不支持union all 我试了下 mysql5是可以的