有一表ab内容如下
id name sex year
1 1 2011
2 ddd 0 2012
3 1 2011
4 1 2011
5 ggg 0 2012
6 1 2011
7 fff 1 2011
8 ggg 0 2012
9 1 2011
10 aaa 1 2000
11 1 2011查找结果为
count(id),group_concat(niu)
11 ,aaa,ddd,,,ggg,,fff,ggg,,aaa,这是我的语句:select count(id),group_concat(name) from ab
找出的结果里含有太多的逗号了,怎么去掉它啊?
理想的结果为:
count(id),group_concat(name)
11 aaa,ddd,ggg,fff,ggg,,aaa
id name sex year
1 1 2011
2 ddd 0 2012
3 1 2011
4 1 2011
5 ggg 0 2012
6 1 2011
7 fff 1 2011
8 ggg 0 2012
9 1 2011
10 aaa 1 2000
11 1 2011查找结果为
count(id),group_concat(niu)
11 ,aaa,ddd,,,ggg,,fff,ggg,,aaa,这是我的语句:select count(id),group_concat(name) from ab
找出的结果里含有太多的逗号了,怎么去掉它啊?
理想的结果为:
count(id),group_concat(name)
11 aaa,ddd,ggg,fff,ggg,,aaa
解决方案 »
- mysql数据库C3P0连接池Acquisition Attempt Failed错误每2分钟发一次警告
- 求一异地备份命令
- 请教 一个MYSQL的语句
- 安装myslq5.0.45 选择哪一个
- SQL语句优化
- 关于MAX_JOIN_SIZE
- 在mysql怎么去掉某个为空的值?
- 关于postgresql数据库启动问题
- 请问如何将SQLServer数据库导入MYSQL(用C API)
- mysql数据恢复啊
- 在mysql 的存储过程中如何实现with nolock功能
- 为什么select count(主键) from table xxx;比select count(*) from table xxx;效率要高?
select count(id),group_concat(name) from ab where name is not null
select count(*), substring_index(GROUP_CONCAT(name order by name desc),',,',1) from ab;