Not Exists?

  • I'd appreciate some assistance. It's fairly basic stuff, and I can get the answer in Access, but I'm struggling in SQL.

    I want to return a list of despatch notes which do not include a particular product.

    I have two tables joined by Doc_Key, the Header_table and the Row_table. I want to return a list of Doc_ID from the header table where the rows(Part_Id,Price,Qty) do not include 'Part1' as the Part_Id.

    Any help with what I know is pretty basic for you people would be greatly appreciated.

  • Select H.Doc_ID

    FROM Header_table H

    LEFT JOIN Row_table R ON H.Doc_ID = R.Doc_ID AND R.Part_Id = 'Part1'

    WHERE R.Doc_ID IS NULL

    _____________
    Code for TallyGenerator

  • Super. Thanks very much.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply