SELECT ORG.DESCRIPTION, ORG.EXTERNALKEY
FROM organization org
WHERE org.ownerid = (SELECT id
FROM organization
WHERE externalkey = '970000')
OR org.externalkey = '970000'
ORDER BY org.description;
This is my sql query. I used “ORDER BY org.description”. But this is not my requirement exactly. I want to make the first (org.externalkey=’970000′) in result of the query. Rows will be ordered (but org.externalkey=’970000′ row will be the first). How to do that?
try this:
You just need to add a CASE statement in the ORDER BY CLAUSE