SELECT new_column, (CASE WHEN new_column < 1000 THEN new_column ELSE new_column + 1000 END) as new_column2 FROM (SELECT (CASE WHEN a.id > 500 THEN a.id ELSE a.id + 500 END) as new_column FROM table as a) as b
-- Не эффективный способ, но приемлемый на маленьких выборках B SELECT B.new_column, IF(B.new_column < 1000, B.new_column, B.new_column + 1000) AS new_column2 FROM ( SELECT IF(a.id > 500, a.id, a.id + 500) as new_column FROM table a ) AS B; -- А можно и так... SELECT (a.id + IF(a.id < 500, 500, 0)) as new_column, (a.id + IF(a.id > 1000, 1000, 0)) as new_column2 FROM table a