G
Guest
I have 2 queries one to get the data and another to group and sum it but for
some reason when try to sum the data for the second query the numbers are way
to big
the Sql for the 1st query is
SELECT Production.Batch, Production.Profile, Production.[Total Pieces],
Production.Preimum, Production.[Rerun Preimum]
FROM Production
GROUP BY Production.Batch, Production.Profile, Production.[Total Pieces],
Production.Preimum, Production.[Rerun Preimum], Production.Date
HAVING (((Production.Batch)=[Enter Batch Number]) AND ((Production.Date)
Between [Enter Start Date (mm/dd/yy) ] And [Enter End Date (mm/dd/yy)]));
And the sql for the one that is summing incorrectly is
SELECT CheckNumbers.Profile, Sum(CheckNumbers.[Total Pieces]) AS [SumOfTotal
Pieces], Sum(CheckNumbers.Preimum) AS SumOfPreimum, Sum(CheckNumbers.[Rerun
Preimum]) AS [SumOfRerun Preimum], Sum(tblImage.[Pieces Per Lift]) AS
[SumOfPieces Per Lift], Sum([CheckNumbers]![Preimum]+[CheckNumbers]![Rerun
Preimum]) AS TotalP, CheckNumbers.Batch
FROM Production, CheckNumbers INNER JOIN tblImage ON CheckNumbers.Profile =
tblImage.Profile
GROUP BY CheckNumbers.Profile, CheckNumbers.Batch, tblImage.Profile
HAVING (((tblImage.Profile)=[CheckNumbers.Profile]));
Any ideas would be great thanks
some reason when try to sum the data for the second query the numbers are way
to big
the Sql for the 1st query is
SELECT Production.Batch, Production.Profile, Production.[Total Pieces],
Production.Preimum, Production.[Rerun Preimum]
FROM Production
GROUP BY Production.Batch, Production.Profile, Production.[Total Pieces],
Production.Preimum, Production.[Rerun Preimum], Production.Date
HAVING (((Production.Batch)=[Enter Batch Number]) AND ((Production.Date)
Between [Enter Start Date (mm/dd/yy) ] And [Enter End Date (mm/dd/yy)]));
And the sql for the one that is summing incorrectly is
SELECT CheckNumbers.Profile, Sum(CheckNumbers.[Total Pieces]) AS [SumOfTotal
Pieces], Sum(CheckNumbers.Preimum) AS SumOfPreimum, Sum(CheckNumbers.[Rerun
Preimum]) AS [SumOfRerun Preimum], Sum(tblImage.[Pieces Per Lift]) AS
[SumOfPieces Per Lift], Sum([CheckNumbers]![Preimum]+[CheckNumbers]![Rerun
Preimum]) AS TotalP, CheckNumbers.Batch
FROM Production, CheckNumbers INNER JOIN tblImage ON CheckNumbers.Profile =
tblImage.Profile
GROUP BY CheckNumbers.Profile, CheckNumbers.Batch, tblImage.Profile
HAVING (((tblImage.Profile)=[CheckNumbers.Profile]));
Any ideas would be great thanks