Union or Join?

  • Hello All,

    I have 3 tables: INFO, VEND, and PROJ.

    The info table has VENDID, PROJID

    The VEND table has ID, VENDNAME (vend.id = info.vendid)

    The PROJ table has ID, Projectname (proj.id = info.projid)

    I need a query that will give me the results of vendor name and project name.

    Something like this:

    Projectname VendorName

    New Alias KMart

    I think I should use a join but I can't figure out how to write the join.

    Thanks,

    D-

  • It's a standard many-to-many join.

    Join the vendor table to the info table, then join the info table to the project table.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Perfect! Not sure why I was being so 'thick'. Seems so simple when someone points it out. Thanks bunches.

  • You're welcome.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

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

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