Hello,
a simple question :
I have a table like this :
name, email_1, email_2
and I want to display in a web page
name, email_1 if it exists, or email_2 if email_1 do NOT exist.
of course I can do this inside a php script, by checking the
content of the columns,
BUT I had like to get the values
I have a table like this :
name, email_1, email_2
and I want to display in a web page
name, email_1 if it exists, or email_2 if email_1 do NOT exist.
SELECT name, IF(email_1 IS NOT NULL AND email_1 != '', email_1,
email_2) AS email FROM theTable;
--
MySQL General Mailing List
For list
Scott Noyes wrote:
I have a table like this :
name, email_1, email_2
and I want to display in a web page
name, email_1 if it exists, or email_2 if email_1 do NOT exist.
What if email_2 does not exist, either?
SELECT name, IF(email_1 IS NOT NULL AND email_1 != '', email_1,
email_2) AS email