MySQL Forums
Forum List  »  General

JOIN with some NULLs (newbie)
Posted by: Sven Delleq
Date: April 07, 2012 03:55AM

Posted here as suggested in sticky note on newbie branch.

I'm trying to get media files whether they have a corresponding description or not.

SELECT * FROM media_table JOIN media_description_table ON (media_table.description = media_description_table.id) WHERE _media_table.id IN (1,2,3,4,5);

This will ONLY pull media files IF the description exists (obviously).

How do I rewrite the above query to pull the media files even if there is no description id corresponding to the mediafile?

Options: ReplyQuote


Subject
Written By
Posted
JOIN with some NULLs (newbie)
April 07, 2012 03:55AM


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.