MySQL Forums
Forum List  »  Newbie

Conditional Column Selections
Posted by: Doug
Date: November 23, 2004 10:21AM

I believe there is a way to make a conditional column selection on the SELECT statement but I am having difficultly finding succinct syntax.

Here is what I want to do:

I have 3 columns
FIRSTNAME
NICKNAME
LASTNAME

FIRSTNAME and LASTNAME are populated on every record. NICKNAME contains data only on occasion.

How can I make my SELECT statement do this:

concat(NICKNAME," ",LASTNAME) OR concat(FIRSTNAME," ",LASTNAME) ONLY WHEN NO NICKNAME OR NICKNAME IS NULL

Thank you for your help.

Options: ReplyQuote


Subject
Written By
Posted
Conditional Column Selections
November 23, 2004 10:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.