Link to home
Start Free TrialLog in
Avatar of Rex
RexFlag for United States of America

asked on

I Have an Inner Join Query that is Returning the Same Values Multiple Times

I Have an Inner Join Query that is Returning the Same Values Multiple Times. Ultimately, I would like to join eight tables, all on the common field Production Date, so this is my attempt to just Join two tables.

My SQL is shown below under code.

A snapshot of a portion of the query results is below as well. It appears the L1 Inspected is repeating, but the L2 and total seem to be O.K,

SELECT [Archive 15th St L1 FPY Weekly Trend].ProductionDate AS L1_ProdDate, Sum([Archive 15th St L1 FPY Weekly Trend].Inspected) AS L1_Inspected, [Archive 15th St L1 FPY Weekly Trend].ProductionDate AS L2_ProdDate, Sum([Archive 15th St L2 FPY Weekly Trend].INSPECTED) AS L2_Inspected, ([Archive 15th St L1 FPY Weekly Trend].Inspected+[Archive 15th St L2 FPY Weekly Trend].INSPECTED) AS SumofInspected
FROM [Archive 15th St L1 FPY Weekly Trend], [Archive 15th St L2 FPY Weekly Trend]
WHERE ((([Archive 15th St L1 FPY Weekly Trend].ProductionDate)=[Archive 15th St L1 FPY Weekly Trend].[ProductionDate]))
GROUP BY ([Archive 15th St L1 FPY Weekly Trend].Inspected+[Archive 15th St L2 FPY Weekly Trend].INSPECTED), [Archive 15th St L1 FPY Weekly Trend.ProductionDate]
ORDER BY [Archive 15th St L1 FPY Weekly Trend.ProductionDate];

Open in new window

Query-Results.jpg
Avatar of ralmada
ralmada
Flag of Canada image

Can you please provide an example of the result you expect?
Avatar of Rex

ASKER

Something like this. The value, 6584, for example, only occurs once in the table, but it is repeated several times in the query results.
example-Desired-Output.jpg
ASKER CERTIFIED SOLUTION
Avatar of ralmada
ralmada
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rex

ASKER

Thank you. Wow. That was a stupid, stupid copy/ paste error on my part. Thanks.
Avatar of Rex

ASKER

Thank you very much. I really appreciate it.