donjohnson
Programmer
- Jun 23, 2004
- 53
Hi! I am new to SQL, and have done some easy queries, but have a problem I can't get past - thanks for your help in advance.
Here's the deal:
Table H contains records with hours columns (QA, IT, Vac, HR), with a key of Date, Site and Shift (one rec/Date,site,shift)
Table D contains recs with a detail of production hours (P_Hours) for each task , using the key Date, Site, Shift and taskid
I need to produce a query recordset that contains a sum of d.P_hours, sum of each h column (h.QA, H.IT, h.VAC, h.HR), a calculation of (h.QA+h.IT+h.Vac+h.HR)/(d.P_Hours), for each Date and Site.
Everything I have tried has produced a cartesian join, and I am at a loss.
Can someone help me here?
Here's the deal:
Table H contains records with hours columns (QA, IT, Vac, HR), with a key of Date, Site and Shift (one rec/Date,site,shift)
Table D contains recs with a detail of production hours (P_Hours) for each task , using the key Date, Site, Shift and taskid
I need to produce a query recordset that contains a sum of d.P_hours, sum of each h column (h.QA, H.IT, h.VAC, h.HR), a calculation of (h.QA+h.IT+h.Vac+h.HR)/(d.P_Hours), for each Date and Site.
Everything I have tried has produced a cartesian join, and I am at a loss.
Can someone help me here?