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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Query Question

Status
Not open for further replies.

nerdalert1

Programmer
Nov 4, 2004
92
US
Ok this might be totally confusing but I am giving it a shot because I am completly confused right now on this and need help. I have a large query that is using a Cross Join in it. Here is the basic part of it.
----------------------------------------------
MAIN QUERY called CC1.

CROSS JOIN tblDepartments INNER JOIN
(QUERY..which has field DeptNumber in SELECT) CC2 ON tblDepartments.DeptNumber = CC2.DeptNumber
----------------------------------------------
the above query worked and it was fine until a change occurred. CC2 is querying a temp table that had DeptNumber in it. However now this Temp table is storing a DeptCustID that is from a table called tblDeptCust which has the DeptNumber in it. So now it looks like this and I dont know how to link to this new tbale called tblDeptCust to get to it.
------------------------------------------------
CROSS JOIN tblDepartments(I need this to stay as is because the MAIN QUERY pulls fields from it) INNER JOIN
(QUERY..which is still the temp table that now has DeptCustID in it) CC2.
------------------------------------------------
How right here do I do the Join to the table tblDeptCust where tblDepartments.DeptNumber = tblDeptCust.DeptNumber


Thanks all


 
I hestitate to ask why you are using a cross join because they can be very slow. However, that aside, I'm not entirely clear on what you want. Could you provide soem sample data and sample results you want. That might make it clearer.

Questions about posting. See faq183-874
Click here to learn Ways to help with Tsunami Relief
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top