I have a table of contacts which has name and default_name columns among others.
Contact name is name, unless name=NULL and then it is default_name (which cannot be NULL).
I would like to order my selection by contact name.
For example:
contact_id name default_name
---------- ---- ------------
1 Dave David
2 Misha
3 Alex
4 Brother Leon Leon
should become:
contact_id name default_name
---------- ---- ------------
3 Alex
4 Brother Leon Leon
1 Dave David
2 Misha
How would I achieve this ?