• TheSQLGuru (6/17/2016)


    I would do it with an AND NOT EXISTS (SELECT ...) clause myself.

    As would I. 🙂

    select distinct item_id

    from jec_item_sup jis

    where supplier=77

    and not exists (select * from jec_item_sup where supplier=jis.supplier and item_id=jis.item_id and primary_supplier='Y')