August 5, 2010 at 7:39 pm
I'm selecting from three different Views, which are basically these: group leader (vwGL), group partner 1 (vwP1), and group partner 2 (vwP2). What I want to show on each row in the resultant query (see it below) is the group leader and the two group partners under the group leader, each with their basic information (last and first names, phone, address, e-mail, etc.). However, I'm obviously missing something, because my row format turns out like this:
Joe Edwards / John Doe / Johnny Doe
Joe Edwards / Jake Lake / Jakey Lake
Joe Edwards / Bill Dill / Billy Dill
Jack Spratt / John Doe / Johnny Doe
Jack Spratt / Jake Lake / Jakey Lake
Jack Spratt / Bill Dill / Billy Dill
...and it needs to be like this:
Joe Edwards / John Doe / Johnny Doe
Joe Edwards / Jake Lake / Jakey Lake
Joe Edwards / Bill Dill / Billy Dill
Jack Spratt / Barak Obama / Barry Obama
Jack Spratt / Fred Bowman / Freddy Bowman
Jack Spratt / Don Wright / Donny Wright
In other words, the same groups of people are repeating under each successive group leader and I don't know how to proceed to correct it. I have something like this so far (which clearly needs help):
SELECT
d.LeaderID, d.Last, d.First, d.Phone, d.Email,
p1.PartnerID, p1.Last, p1.First, p1.Phone, p1.Email,
p2.PartnerID, p2.Last, p2.First, p2.Phone, p2.Email
FROM vwGL AS d, vwP1 AS p1, vwP2 AS p2
WHERE [need help on joins]
ORDER BY d.LeaderID, p1.PartnerID
Let me know of any other info you need on this case. Thanks in advance for your help.
August 6, 2010 at 10:11 am
Please provide table def, sample data and expected result together with what you've tried so far. For details on how to post sample data please see the first link in my signature.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply