このような私のtwpテーブル。
+----+--------+ +----------+-------+--------+
| id | fruit | | fruit_id | color | amount |
+----+--------+ +----------+-------+--------+
結果:
SELECT
fruit,amount
FROM
table1,table2
WHERE fruit_id = id
+--------+--------+
| fruit | amount |
+--------+--------+
| Apple | 5 |
| Apple | 5 |
| Cherry | 2 |
| Cherry | 2 |
+--------+--------+
しかし、私はこの結果が欲しい:
+--------+--------+
| fruit | amount |
+--------+--------+
| Apple | 10 |
| Cherry | 4 |
+--------+--------+