I have this kind of mysql db (table name/fields)
tbl_users: id, title, approved
tbl_photos: id, user_id, title, filename
I have one row in users, and three photos (all with user_id = the id of the user)
doing this:
select
tbl_users.*,
tbl_photos.filename
from tbl_users
left join tbl_photos on tbl_photos.user_id = tbl_users.id
where tbl_users = '1' order by rand()
(table query simplified a little bit)
doing that sql query returns three rows . I only want one row (ie i want the user row, plus any random photo that has the user_id of that user id)
i've tried all joins - left right inner but they always return 3 rows