Created
August 12, 2015 03:52
-
-
Save jhesyong/47c9bdf8097f33215a66 to your computer and use it in GitHub Desktop.
Put null to the last when using left join
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM media | |
LEFT JOIN media_priority | |
ON (media_priority.media_id = media.id AND media_priority.media_tag = '".$tag."') | |
WHERE something = 'something' | |
ORDER BY (media_priority.media_order IS NULL) ASC, media_priority.media_order ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment