21,891
社区成员
发帖
与我相关
我的任务
分享
mysql> select * from cpu;
+-----------+
| productid |
+-----------+
| 1 |
| 2 |
| 3 |
| 4 |
+-----------+
4 rows in set (0.00 sec)
mysql> select * from drive;
+-----------+
| productid |
+-----------+
| 1 |
| 2 |
| 3 |
+-----------+
3 rows in set (0.00 sec)
mysql> select concat(group_concat(distinct cpu.productid),',',
-> group_concat(distinct drive.productid)) productids
-> from cpu,drive;
+---------------+
| productids |
+---------------+
| 1,2,3,4,1,2,3 |
+---------------+
1 row in set (0.00 sec)
SELECT ProductID FROM Accessories,CPU。。。