SQL Help with two table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ProgrammingStudent
    New Member
    • Feb 2008
    • 4

    SQL Help with two table

    Here's the deal. I have two table but I want to include everything in table A that isn't in table B.

    I have a list of product numbers in table A and I want to make a list of the one's in table B that haven't been used yet.

    SELECT TableA.ProductN umer
    FROM Table A Full Join TableB
    ON TableA.ProductN umber <> TableB.ProductN umber
    Last edited by ProgrammingStudent; Feb 19 '08, 05:36 AM. Reason: Not Complete
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by ProgrammingStud ent
    Here's the deal. I have two table but I want to include everything in table A that isn't in table B.

    I have a list of product numbers in table A and I want to make a list of the one's in table B that haven't been used yet.

    SELECT TableA.ProductN umer
    FROM Table A Full Join TableB
    ON TableA.ProductN umber <> TableB.ProductN umber
    Try this:

    [code=sql]

    SELECT productnumber FROM tableA WHERE productnumber NOT IN (SELECT productnumber from tableb)

    [/code]

    Comment

    • ProgrammingStudent
      New Member
      • Feb 2008
      • 4

      #3
      Thank you. It worked perfectly!

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by ProgrammingStud ent
        Thank you. It worked perfectly!
        You are welcome :) .

        Comment

        Working...