I\'m using mySQL. I have to order names of Contacts by Lastname but in the case that there is no last name, I order by firstname.
This looks like:
OR
Use COALESCE and NULLIF:
ORDER BY COALESCE(NULLIF(LastName, ''), FirstName), FirstName