MySQL Forums
Forum List  »  Newbie

Re: Question about query involving null values
Posted by: Jeffrey Roden
Date: March 27, 2016 12:51PM

I came up with the following query which correctly returns LastName and PreferredFirstName if present, but I need to concatenate it into the following format:

LastName, PreferredFirstName
or
LastName, FirstName
if PreferredFirstName is Null

SELECT
last_name,
IFNULL(preferred_first_name, first_name)
FROM
people

Options: ReplyQuote


Subject
Written By
Posted
Re: Question about query involving null values
March 27, 2016 12:51PM


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.