tags:

views:

183

answers:

1

I have three columns in my table - company_name, first_name, last_name. In the result of a SELECT, I'd like to have only one column: name, which should contain content of company_name if it's not NULL or concatenation of first_name +' '+ last_name, if the company_name is not set.

Any advice? Thanks!

+5  A: 

SELECT IFNULL(company_name,CONCAT(first_name,' ',last_name)) as NAME

Ivan
Works perfectly! Thank you.
Milan Novota