> 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 archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to