• beb9021 (3/1/2013)


    I ran this query:

    Select Date, Analyst_EID, Journey_EID, Accountant_EID

    From Table_2

    join Table_1

    on Table_2.Analyst_EID = Table_1.EID

    and Table_2.Journey_EID = Table_1.EID

    and Table_2.Accountant_EID = Table_1.EID

    Order by Date ASC

    What you are asking for here is any record(s) from Table_2 where the Analyst_EID, Journey_EID and Accountant_EID are all the same. What you really want is to create a pivot or crosstab query. I'm sure there are more elegant solutions but something like this would probably work:

    Select Table_2.Date, MAX(t1analyst.Name ), MAX( t1j.Name ), MAX(t1acct.Name )

    From Table_2

    left join Table_1 t1analyst on Table_2.Analyst_EID = t1analyst.EID

    left join Table_1 t1j on Table_2.Journey_EID = t1j.EID

    left join Table_1 t1acct on Table_2.Accountant_EID = t1acct.EID

    group by Table_2.Date

    Order by Table_2.Date ASC

    _____________________________________________________________________
    - Nate

    @nate_hughes