Rog D
asked on
Need some help with TSQL Case Statement.
Current Statement
select emp.fullname,emp.dept,emp. deptLstnon 9800 from ol_employee emp
where 'A'='A'
AND (case emp.dept when '9800' then deptlstnon9800 else EMP.dept end Not like '45%')
AND (case emp.dept when '9800' then deptlstnon9800 else EMP.dept end Not like '46%')
order by dept
Currently it just looks at emp.dep when '9800'. I now need to also add '4800' to the WHEN.
Thought I coud just use "OR" or IN but neither work I get errors. Looking for some assistance on how to do this.
Thanks.
select emp.fullname,emp.dept,emp.
where 'A'='A'
AND (case emp.dept when '9800' then deptlstnon9800 else EMP.dept end Not like '45%')
AND (case emp.dept when '9800' then deptlstnon9800 else EMP.dept end Not like '46%')
order by dept
Currently it just looks at emp.dep when '9800'. I now need to also add '4800' to the WHEN.
Thought I coud just use "OR" or IN but neither work I get errors. Looking for some assistance on how to do this.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER