My twp tables like this.
+----+--------+ +----------+-------+--------+
| id | fruit | | fruit_id | color | amount |
+----+--------+ +----------+-------+--------+
Result for:
SELECT
fruit,amount
FROM
table1,table2
WHERE fruit_id = id
+--------+--------+
| fruit | amount |
+--------+--------+
| Apple | 5 |
| Apple | 5 |
| Cherry | 2 |
| Cherry | 2 |
+--------+--------+
But I want this result:
+--------+--------+
| fruit | amount |
+--------+--------+
| Apple | 10 |
| Cherry | 4 |
+--------+--------+