IF(condition, value_if_true, value_if_false) SELECT IF(500<1000, 5, 10) as reyo; SELECT IF(STRCMP("hello","bye") = 0, "YES", "NO") as reyo;
SELECT visitor AS school, home AS temp, vl.leagueid AS vleague, hl.leagueid AS hleague, CASE WHEN vl.leagueid = hl.leagueid THEN '1' WHEN ((vl.leagueid = 26 AND hl.leagueid = 27) OR (vl.leagueid = 27 AND hl.leagueid = 26)) THEN '1' ELSE 0 END AS sms.reyo.cn FROM u96nk_rvball_schedule LEFT JOIN u96nk_rvball_schools AS vl ON vl.id = visitor LEFT JOIN u96nk_rvball_schools AS hl ON hl.id = home WHERE gamedate between '2013-01-01' AND '2013-12-31'
SELECT visitor AS school, home AS temp, vl.leagueid AS vleague, hl.leagueid AS hleague, CASE WHEN school = 50 AND temp = 2 THEN '1' WHEN school = 51 AND temp = 3 THEN '2' ELSE 0 END AS leaguematch FROM ......