Link to home
Start Free TrialLog in
Avatar of LCNW
LCNWFlag for United States of America

asked on

SQL Function Syntax

I have this CASE:

      SELECT
            @Result      =      CASE
                                    WHEN dr.OrganOutcomeDetail
                                    
                                    IN
                                    
                                    (      
                                          '16B26174-37E5-441A-BD79-801567CA2F50' --SCD Donor
                                    ,      '4FED8930-B4FE-4CC5-83C8-B7D56AA6A10A' --ECD Donor
                                    )
                                    
                                    OR
                                    (
                                    dr.OrganOutcome = '8BC4608C-7412-4930-B000-788721F55501' -- No Permission
                                    AND dr.BrainDeathNA = 0
                                    AND dr.BrainDeath1On is not null
                                    OR dr.BrainDeath1OnTimeZone is not null
                                    )
                                    
                                    OR
                                    (
                                    dr.OrganOutcome = '8BC4608C-7412-4930-B000-788721F55501' -- No Permission
                                    AND dr.BrainDeathNA = 0
                                    AND dr.BrainDeath2On is not null
                                    OR dr.BrainDeath2OnTimeZone is not null
                                    )
                                    
                                    OR
                                    (
                                    dr.OrganOutcomeBrainDeath = '3' -- Appears Areflexic
                                    )
      
                                    
            
                                    
                                    

                                    
                                    
                                    THEN 1 ELSE 0
                              END

I need to add the following:

                                    AND
                                    (
                                    dr.OrganOutcome != '6c92e890-0894-4685-bafd-b0d5043407c8'
                                    )

I can't seem to get the result I'm looking for.
ASKER CERTIFIED SOLUTION
Avatar of 5teveo
5teveo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LCNW

ASKER

@5teveo,

This pointed me in the right direction and I got it working. Thanks