Last active
December 25, 2017 05:15
-
-
Save nhatnx/4ddbd22f67f1229412cf1e38604eac3a to your computer and use it in GitHub Desktop.
ORDER BY column which is a mixed of multi columns with some criteria
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 table | |
| ORDER BY | |
| CONCAT | |
| (CASE WHEN (security_title_name IS NOT NULL AND security_title_name != '') AND (release_date IS NOT NULL AND release_date != '') AND (release_date > CURRENT_DATE) THEN security_title_name | |
| ELSE official_title_name | |
| END) | |
| ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment