My table has two columns which I need to sort by:
content title
Only some rows have data in the content column but all have some in the title column. I need to sort these rows so that those with data in the content column are first. I can do this by:
ORDER BY content DESC, title ASC
However, those top rows returned because of their content column also need to be sorted alphabetically by their title (not by their content which I assume is happening).
Ideas? Thanks.
Update:
Should have noted that title is a VARCHAR and content is TEXT. So arbitary text. content column is empty if no content, not NULL.
So for example:
`title` `content`
title a
title b this has content
title c so does this
title d
The order would be:
title c
title b
title a
title d
If I understand what you need, try this: