I wish I could think of a good reason to have a CASE statement in a WHERE statement -- but I can't so I'll just show something that works.
One day...
SELECT ename
, job
, deptno
FROM scott.emp
WHERE job LIKE
CASE
WHEN deptno = '20' THEN '%AL%'
WHEN deptno = '30' THEN '%MAN%'
END
ORDER BY deptno, job
;
No comments:
Post a Comment