CASE WHEN UPPER(LTRIM(RTRIM(szTransactionMode in ('ADD','DELETE') AND szDestination <> 'UNKNOWN' THEN 'X' WHEN UPPER(LTRIM(RTRIM(szTransactionMode = 'CHANGE' AND UPPER(o.szTransactionRevision) LIKE '%DQUANTITY%' AND szDestination <> 'UNKNOWN' THEN 'X' WHEN UPPER(LTRIM(RTRIM(szTransactionMode = 'CHANGE' AND UPPER(o.szTransactionRevision) LIKE '%SZCODEQUANTITY%' AND szDestination <> 'UNKNOWN' THEN 'X' ELSE 'Y' END = 'X'