56,687
社区成员
发帖
与我相关
我的任务
分享
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> 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>