MySQL在where后面使用case when
转:https://blog.csdn.net/qq_27686779/article/details/80318252
select *
from A, B
where
CASE
when A.id = 0 then B.name in ('aaa', 'bbb')
when A.id = 1 then B.name in ('bbb', 'ccc')
when A.id = 2 then B.name in ('ccc', 'ddd')
END