最佳答案
SELECT name, price, photo FROM drinks, drinks_photos WHERE drinks.id = drinks_id
yeilds 5 rows (5 arrays), photo
is the only unique field in a row. name, price
get repeated (here, fanta-
name, price
repeat 3 times.) How do i get rid of these duplicates?
Edit: I want name, price
and all photo
for each drink.
id name price
1. fanta 5
2. dew 4
id photo drinks_id
1. ./images/fanta-1.jpg 1
2. ./images/fanta-2.jpg 1
3. ./images/fanta-3.jpg 1
4. ./images/dew-1.jpg 2
5. ./images/dew-2.jpg 2