我在 sqlite 的数据库中有 3 个表
表 A
+-----+-------+
| id | name |
+-----+-------+
| 1 | Ann |
| 2 | Bill |
| 3 | Mike |
| 4 | Zoey |
+-----+-------+
表 B
+-----+-----+
| idA | idC |
+-----+-----+
| 1 | 1 |
| 1 | 2 |
| 2 | 3 |
| 3 | 2 |
| 4 | 1 |
+-----+-----+
表 C
+-----+-----+
| id | type|
+-----+-----+
| 1 | x |
| 2 | y |
| 3 | z |
+-----+-----+
我试过了:
CREATE VIEW test AS SELECT A.id, A.name, C.type
FROM A, B, C
WHERE B.idA = A.id
AND B.idB = B.id
然后我得到:
**View test**
+-----+-------+-------+
| id | name | type |
+-----+-------+-------+
| 1 | Ann | x |
| 1 | Ann | y |
| 2 | Bill | z |
| 3 | Mike | y |
| 4 | Zoey | x |
+-----+-------+-------+
但我想做这样的事情
+-----+-------+-------+
| id | name | type |
+-----+-------+-------+
| 1 | Ann | x,y |
| 2 | Bill | z |
| 3 | Mike | y |
| 4 | Zoey | x |
+-----+-------+-------+
没有重复任何行,这可能吗?