MySQL Forums
Forum List  »  Newbie

Show user even if gallery is empty
Posted by: Jassim Rahma
Date: April 10, 2023 02:28PM


I am trying below SELECT that I need to get the user and the gallery row.

It should always return one row because I will always have one gallery with is_profile_photo set to TRUE.

The code is working fine when I have a row inside my gallery table but if I don't have that row (set to TRUE) it will return nothing.

What I want is to still return the users.user_uud and the members.gender even when there is no row inside the gallery of when there is a row but with is_profile_photo set to FALSE.

SELECT users.user_uuid, gallery.gallery_uuid,
FROM gallery
LEFT JOIN members ON members.user_id = gallery.user_id
LEFT JOIN users ON users.user_id = members.user_id
WHERE members.user_id = 1488
AND gallery.is_profile_photo = TRUE;

How can I do this please?


Options: ReplyQuote

Written By
Show user even if gallery is empty
April 10, 2023 02:28PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.