MySQL Forums
Forum List  »  Newbie

Re: Show user even if gallery is empty
Posted by: Phillip Ward
Date: April 17, 2023 07:52AM

Little known "trick" with joins:


Move your gallery condition into the Join clause:

, g.gallery_uuid
, m.gender
FROM members m 
LEFT JOIN users u 
  ON m.user_id = u.user_id
LEFT JOIN gallery g 
  ON m.user_id = g.user_id
 AND g.is_profile_photo = TRUE 
WHERE m.user_id = 1488

Regards, Phill W.

Options: ReplyQuote

Written By
Re: Show user even if gallery is empty
April 17, 2023 07:52AM

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.