Select subject if not empty, otherwise select text
Posted: Tue Dec 28, 2010 2:20 am
I am trying to write a query that selects the "subject" column unless that column is empty, in which case it should select the text "(No Subject)". Is there a function or something I can use in MySQL to accomplish something like this?
Code: Select all
SELECT
UNLESS_IS_EMPTY(subject, '(No Subject)') -- Is there a function that does something like this?
FROM messages
WHERE
...