Case statement with multiple field conditions
I'm trying to write a beast mode fiter that looks for a condition in one field and also searches multiple fields to return a "yes" value. Seems simple enough, but...
I want it to:
Look in CPT code field and find all records with CPT code of 20610, then look in 5 diagnosis code fields to exclude the procedures that deal with Osteoarthritis. Something like:
case when `cpt_code` = '20610' AND
`icd_1` <> '71516'
`icd_2` <> '71516'
`icd_3` <> '71516'
`icd_5` <> '71516'
Basically, this would show me all the large joint injections EXCEPT the ones that deal with OsteoArthritis of a joint.
I keep getting syntax errors... any thoughts? The code for OA could exist in any one of the ICD fields, which is why it needs to search all 4 fields for the OA code (test for that condition) before it allows this procedure to show up on the graph. Need help "structuring" the beast mode to accomplish this. Thanks in advance... I don't see any examples of this type of filtering in the Dojo.