Solved

SQL Case When with embedded "or' conditions

Posted on 2015-01-11
2
120 Views
Last Modified: 2015-01-11
I am trying to write a Case When statement with three conditions.  The first two are straight forward.  The third is a Case when with 4 or conditions:

Case when OE.Category = 'PHA' then
                                 case when P.DirectionID = '.STK-MED' then 
                                 [b]case when MOS.ProviderYn = 'Y' then 
                                      when MOS.CosignYn = 'Y' then 
                                      when OE.OrderDateTime = OEOS.SigDateTime then
                                      when DMU.ProviderID = OE.ProviderID[/b] then 1 else 0 end else 0 else 0 end as TotMedCPOE

Open in new window


As you see if the OE.Gategory = "PHA" and the P.DirectionID = '.STK-MED' no problem.  However the third condition can be anyone of 4 to be true.  What is the proper syntax for the last condition?

thanks Glen
0
Comment
Question by:GPSPOW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40543354
CASE WHEN MOS.ProivderYn = 'Y" or MOS.CosignYN = 'Y' or

etc.
0
 

Author Closing Comment

by:GPSPOW
ID: 40543365
Thank you
0

Featured Post

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question