mlsamuelson.com

IF() - evaulate if conditions in MySQL statements

IF(expression1,expression2,expression3)
if expression1 is true, returns expression2, otherwise, returns expression3

an example:

SELECT IF(a.phone_pref = 'home', a.home_phone, a.work_phone) AS phone
FROM individual a;

Find Me Around

User login