Joining on 3 tables isse

  • Hello,

    I am having trouble with joining 3 tables.

    1 table is the primary call it jobs, second is material, third is called labor

    job will have all jobs, SOMETIMES the job will have material, sometimes job will have ONLY labor, BUT most of the time it will have job, material and labor...

    sadly can anyone help me out on how I can accomplish it looking something like ( the - dash is blank or null):

    Column

    job Labor Material

    1 2 3

    2 - 2

    3 3 -

    4 5 6

    I know this is possible, but trying to think how :(, any example will work if anyone can give it or use my example is fine.

  • Select FROM the job table and user LEFT OUTER JOINs on the other two tables.

    [This sounds possibly like class work or home work, so I'm just giving a general guideline rather than specific code.]

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • ScottPletcher (5/19/2015)


    Select FROM the job table and user LEFT OUTER JOINs on the other two tables.

    Providing they are 1:1 relationships otherwise you would get a cartesian result

    Far away is close at hand in the images of elsewhere.
    Anon.

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

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