I have a table called idcards with a foreign key on the id of the table reservations. Then I have a table photos that has a foreign key on the id in table idcards.
I want to select all from idcards where the reservation id is a certain value, plus the photos that are attached to this idcard.
This is what I have so far, but it obviously selects only one photo per idcard:
SELECT i.*, p.photo
FROM idcards AS i
INNER JOIN photos AS p
ON (i.id=p.iId)
WHERE i.resId = 1
How can I make it so the idcards that I get have an array with all the photos ?