表1:
+------------+--------------+-----------------+
| product_id | product_name | product_type_id |
+------------+--------------+-----------------+
| 1 | 产品A | 1,2 |
| 2 | 产品B | 2,3 |
+------------+--------------+-----------------+
表2:
+-----------------+-------------------+
| product_type_id | product_type_name |
+-----------------+-------------------+
| 1 | 类别1 |
| 2 | 类别2 |
| 3 | 类别3 |
+-----------------+-------------------+:
生成以下效果:
+------------+--------------+-----------------+
| product_id | product_name | type |
+------------+--------------+-----------------+
| 1 | 产品A | 类别1,类别2 |
| 2 | 产品B | 类别2,类别3 |
+------------+--------------+-----------------+
在网上查了都是关于mysql的语句如:select product_id,product_name,group_concat(product_type_name) as type from ab,ac where instr(ab.product_type_id,ac.product_type_id) group by product_id,product_name;
可是在oracle上不能用求大神帮忙呀!