D
Dustin Ventin
I am trying to write a query that returns a fairly simple set of information.
I have linked two tables together, I want to show data from both. I also
include a couple fields which will always be the same. Unfortunitely,
because (I guess) my join is not specific enough, I wind up with seven copies
of two different records, resulting the 14 records when I want 2.
I can "Group By", and that returns 2 recrods. However, then I want too sum
the values in two of the fields. If I select "Sum", the query returns the
sum of all 14 records, which obviously is a completely incorrect calculation.
I know I'm doing something wrong. I tried DISTINCTROW to select unique rows
only, but that doesn't change anything in the slightest. The code for the
SQL query is as follows:
SELECT DISTINCTROW tblPrimaveraDetail.PD_ActivityID AS ACT,
tblPrimaveraDetail.PD_ActivityDescription AS TITLE,
tblEstimateDetail.ED_OHandPTotal AS BC, '1' AS BQ, "OVERHEAD & PROFIT" AS RES
FROM tblEstimateDetail INNER JOIN tblPrimaveraDetail
ON tblEstimateDetail.ED_Primavera_ID = tblPrimaveraDetail.PD_ActivityID
WHERE
(((tblPrimaveraDetail.PD_UProj_ID)=[forms]![frmProjectMain]![txtUProj_ID]));
Ideas? Thanks!
Dustin
I have linked two tables together, I want to show data from both. I also
include a couple fields which will always be the same. Unfortunitely,
because (I guess) my join is not specific enough, I wind up with seven copies
of two different records, resulting the 14 records when I want 2.
I can "Group By", and that returns 2 recrods. However, then I want too sum
the values in two of the fields. If I select "Sum", the query returns the
sum of all 14 records, which obviously is a completely incorrect calculation.
I know I'm doing something wrong. I tried DISTINCTROW to select unique rows
only, but that doesn't change anything in the slightest. The code for the
SQL query is as follows:
SELECT DISTINCTROW tblPrimaveraDetail.PD_ActivityID AS ACT,
tblPrimaveraDetail.PD_ActivityDescription AS TITLE,
tblEstimateDetail.ED_OHandPTotal AS BC, '1' AS BQ, "OVERHEAD & PROFIT" AS RES
FROM tblEstimateDetail INNER JOIN tblPrimaveraDetail
ON tblEstimateDetail.ED_Primavera_ID = tblPrimaveraDetail.PD_ActivityID
WHERE
(((tblPrimaveraDetail.PD_UProj_ID)=[forms]![frmProjectMain]![txtUProj_ID]));
Ideas? Thanks!
Dustin