求一条sql语句 比如表里字段cid=5的记录有三条select id from ttt where cid=5这条语句正常情况下会返回3条记录,现在我想让它只返回一行记录,但显示出来的是三个用逗号分隔的ID 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select group_concat(id) from ttt where cid=5; select group_concat(id) from ttt where cid=5 group by cid select group_concat(id) from ttt where cid=5; mysql> select * from ad2008;+------+------+| id | cid |+------+------+| 1 | 5 || 2 | 5 || 10 | 5 |+------+------+3 rows in set (0.00 sec)mysql> select group_concat(id) from ad2008 where cid=5;+------------------+| group_concat(id) |+------------------+| 1,2,10 |+------------------+1 row in set (0.00 sec)mysql> 我这边怎么返回了这个值啊,[BLOB - 20字节]我看了下字段类型是整型的啊 测试用的就是整型啊mysql> desc ad2008;+-------+---------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+---------+------+-----+---------+-------+| id | int(11) | YES | | NULL | || cid | int(11) | YES | | NULL | |+-------+---------+------+-----+---------+-------+2 rows in set (0.02 sec)mysql>贴出你的表结构看看。 求一段mysql建库建表语句,要有表关联的语句 mysql insert 多表数据 mysql ITERATE的疑问!!!! php区怎么了?谁知道? 某些版本的mysql不支持join语句?急!!! 高手们帮我看看啊。急啊。看看这条select错误在哪里???????? 哪里有MySQL的源代码下载啊? mysql中字符串如何比較大小???? 关于MYSQL中的各种重命名 mysql基准测试 对有auto_increment的表插入数据的问题 在大量数据的情况下看看谁的效率高
+------+------+
| id | cid |
+------+------+
| 1 | 5 |
| 2 | 5 |
| 10 | 5 |
+------+------+
3 rows in set (0.00 sec)mysql> select group_concat(id) from ad2008 where cid=5;
+------------------+
| group_concat(id) |
+------------------+
| 1,2,10 |
+------------------+
1 row in set (0.00 sec)mysql>
mysql> desc ad2008;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| cid | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.02 sec)mysql>贴出你的表结构看看。