Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining to a table twice

Status
Not open for further replies.

mattspits

Programmer
Oct 29, 2002
1
US
Hello,

Here is my problem. I will send the query pkActionItems from tbl_ActionItems. This is what I have so far:

Code:
SELECT
  a.pkActionItems,
  a.ItemDescription,
  LeadWiz.Last AS LastLead,
  TeamWiz.Last AS LastTeam
FROM tbl_ActionItems a 
  LEFT OUTER JOIN (SELECT l.fkActionItems, l.fkWizards, w.pkWizards, w.Last 
		   FROM tbl_Lead l 
		     JOIN tbl_Wizards w ON l.fkWizards = w.pkWizards) AS LeadWiz
		     ON a.pkActionItems = LeadWiz.fkActionItems	
								
  LEFT OUTER JOIN (SELECT t.fkActionItems, t.fkWizards, w.pkWizards, w.Last 
	           FROM tbl_Team t 
		     JOIN tbl_Wizards w ON t.fkWizards = w.pkWizards) AS TeamWiz
		     ON a.pkActionItems = TeamWiz.fkActionItems
WHERE a.pkActionItems IN (#form.pkActionItems#)

It is not giving me the output I would like. Any ideas?

ProblemQuery.jpg
 
okay, first of all, what's the query doing? secondly, what's in those tables? can you give example rows showing how the data relates? finally, what output would you like?


rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top