我在查询中遇到了问题,出了什么错吗?
SELECT
CASE
WHEN cp_pessoa.score < 100 THEN 1
WHEN cp_pessoa.score < 300 THEN 2
WHEN cp_pessoa.score >= 300 THEN 3
END as id_ranking
FROM cp_pessoa
WHERE id_ranking IN (1,2);
我遇到了这个错误:#1054 - 在 'where clause' 中未知的列'id_ranking'
谢谢!