1
我需要的信息從兩個表合併成一個表,下表是從兩個表中的信息合併到一個表
table 1
+----+---------------+---------+
|id_k| name | value |
+----+---------------+---------+
| 1 | enak | 4 |
| 2 | nor | 3 |
+----+---------------+---------+
table 2
+------+------+---------+
| id_d | id_k | feel |
+------+------+---------+
| 1 | 1 | good |
| 2 | 1 | better |
| 3 | 1 | verygood|
+------+------+---------+
結果應該是
+------+------+-------+------------------------+
| id_d | name | value | feel |
+------+------+-------+------------------------+
| 1 | enak | 4 | good, better, verygood |
| 2 | nor | 3 | |
+------+------+-------+------------------------+
這是我的代碼[不工作]
select k.name, k.value, s.feel
from table1 as k
left join table2 as s on s.id_k=k.id_k
(我敢問)你爲什麼要格式化這樣的結果呢? – Strawberry