nuttyernurse
Technical User
Hello all!
I am trying to report on orders using the sql below. The problem is it returns values that are not in the PERF_DEPT_ID or OGROUP_ID criteria. The results of the query are attached as well.
Any help is appreciated!
SELECT
ORDER_ITEM_SEQ,
PERF_DEPT_ID,
OGROUP_ID,
ORDER_NAME,
PREFERRED_DISPLAY_NAME
FROM
CCDEV.O_ITEM
WHERE
PERF_DEPT_ID IN ('BED','CAR','CCL','CM','CMU','CRH','DIET','DIST','DLY','DMGT','END','EQP','HF','IFC','LAB','NEU','NSG','OT','PT','RAD','RSP','RX','SPH','VAS','WOC','XNSG')
AND
OGROUP_ID IN ('BED','CAR','CST','ECHO','EKG','CCL','CM','CMU','CRH','DIET','DIST','DLY','DMGT','END','EQP','HF','IFC','BLBK','CHEM','HEMA','IMMU','LAB','MICR','REF','NEU','NSG','OT','PT','CT','MG','MRI','NM','NP','RF','US','XA','XR','RSP','RX','SLP','VAS','WOC','XNSG')
AND ORDER_NAME NOT LIKE 'ZZ%'
AND ORDER_NAME NOT LIKE 'zz%'
AND INACTIVE_DDT IS NULL or INACTIVE_DDT = 9999999999
I am trying to report on orders using the sql below. The problem is it returns values that are not in the PERF_DEPT_ID or OGROUP_ID criteria. The results of the query are attached as well.
Any help is appreciated!
SELECT
ORDER_ITEM_SEQ,
PERF_DEPT_ID,
OGROUP_ID,
ORDER_NAME,
PREFERRED_DISPLAY_NAME
FROM
CCDEV.O_ITEM
WHERE
PERF_DEPT_ID IN ('BED','CAR','CCL','CM','CMU','CRH','DIET','DIST','DLY','DMGT','END','EQP','HF','IFC','LAB','NEU','NSG','OT','PT','RAD','RSP','RX','SPH','VAS','WOC','XNSG')
AND
OGROUP_ID IN ('BED','CAR','CST','ECHO','EKG','CCL','CM','CMU','CRH','DIET','DIST','DLY','DMGT','END','EQP','HF','IFC','BLBK','CHEM','HEMA','IMMU','LAB','MICR','REF','NEU','NSG','OT','PT','CT','MG','MRI','NM','NP','RF','US','XA','XR','RSP','RX','SLP','VAS','WOC','XNSG')
AND ORDER_NAME NOT LIKE 'ZZ%'
AND ORDER_NAME NOT LIKE 'zz%'
AND INACTIVE_DDT IS NULL or INACTIVE_DDT = 9999999999