Alright this is my situation:
I have 2 tables: photos, gallery.I just want to show all galleries with one photo from each gallery, but I have in photos(TABLE) column title_photo.
I want to show that image, which has title_photo='y' of course some images from other gallery doesn't have it(They have title_photo = 'n'). I have this sql
SELECT * FROM photosRIGHT JOIN galleryON gallery.code = photos.gallery_codeWHERE photos.title_photo = 'y'GROUP BY gallery.id
I have 4 galleries and in only one I set in row (photos TABLE) title_photo = 'y'
. That sql shows only one gallery, which has in photos(TABLE) set title_photo = 'y'
.
My question is:
Is there any solution to show other galleries(they have photos.title_photo = 'n'
) and show gallery which has title_photo = 'y'
?