title: Excluding negative numbers based off of two out of several results in a column
body: <p>I'm running a query that results in quantities of both negatives and positives for transactions. I want these to both show for used products; however, I only want to show positives for the deliveries and transfers.</p>
  
  <p>Used, delivery and transfer all are being pulled from the Transaction Type column. I do not know the best method to limit the positives only quantities to just the delivery and transfer transaction types and keep both positives and negatives for used.</p>
  
  <p>I attempted limiting this in the where clause, but that either limited it to pulling strictly deliver and transfers only OR pulling only positives for all transaction types.</p>
  
  <p>In the code below, it shows a case statement that I attempted, however, it threw an error when attempting to run the script.</p>
  
  <pre><code>SELECT distinct 
    case when NOT upper(transaction_type) = 'PURCHASE' 
              AND DST_PROPERTY_TYPE = 'WAREHOUSE' THEN 'Return' 
         ELSE transaction_type END transaction_type
    , transaction_type as transaction_type_OG --, division_name2
    , case when transaction_type in ('Delivery','Transfer') 
           then quantity &gt;=0 else quantity end
    , transaction_id
    , comments
    , src_division_name
    , src_property_name
    , src_property_type
    , src_afe, src_rig_name
    , dst_division_id
    , dst_division_name
    , dst_property_name
    , dst_property_type
    , dst_afe
    , dst_rig_name
    , M.CATEGORY_NAME
    , item_id
    , item_name
    , quantity
    , created_by, ticket_number
  FROM transactions.tables m
  WHERE not CATEGORY_ID IN ('1294','1295','1337') 
    AND MASTER_PROPERTY NOT LIKE '%products%' 
    AND MASTER_PROPERTY NOT LIKE '%TEST%' 
    and transaction_dt = trunc(sysdate) - 1
  order by transaction_type, src_property_type, src_property_name
  </code></pre>