
December 1st, 2004, 07:52 AM
|
|
Contributing User
|
|
Join Date: Oct 2003
Location: USA (Boston area)
Posts: 81
Time spent in forums: 10 h 42 m 44 sec
Reputation Power: 5
|
|
|
Going to tables in different branches with one query
Hi,
I have five tables p,pm,m,i and bu. Tables 'pm' and 'm' are a branch of table 'p', and table 'bu' is another branch of table 'p'. I know how to run a query to get through the first four tables 'p','pm','m' and 'i' in the manner:
Code:
sql="SELECT p.id,p.project_name, p.fngp_item,p.project_leader,p.project_lead_center,p.project_location,m.milestone_name,i.keyed_name" & _
", i.name, m.milestone_leader, m.mgr_opinion FROM PROJECT p INNER JOIN PROJECT_MILESTONE pm ON p.id = pm.source_id INNER " & _
"JOIN MILESTONE m ON pm.related_id = m.id INNER JOIN [IDENTITY] i ON m.milestone_leader = i.id WHERE m.mgr_opinion='75' " & _
"order by p.project_location, p.project_lead_center"
But when i find an item where m.mgr_opinion is equal to 75 i don't know how to include in the query the item that belongs to the table 'bu', because it is in a different branch.
Can anybody help me on that? Thanks
|