• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 459
  • Last Modified:

Need some help with TSQL Case Statement.

Current Statement

select emp.fullname,emp.dept,emp.deptLstnon9800 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.
0
Rog D
Asked:
Rog D
1 Solution
 
tim_csCommented:
CASE WHEN emp.dept = '9800' OR emp.dept = '4800' THEN deptlstnon9800 ELSE emp.dept END
0
 
Rog DManager Inforamtion SystemsAuthor Commented:
Thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now