Hello Tek-Tips,
I am attempting to summarize customer totals into one amount from two different Access Tables, the Events and EventDetail Tables. The Sum() function from the EventDetail table returns the correct result, however, the amounts returned from the Events Table are duplicated by the amount of entries in the EventDetail Table. There is only one record in the Events Table and could be many in the EventDetail table Here is my SQL string:
SELECT Customers.CustomerName, sum(EventDetail.Quantity*EventDetail.Price+Events.MeetingRoomPrice+Events.Grat11+Events.Grat7+Events.SalesTax) AS EventTotal
FROM (Events INNER JOIN Customers ON Customers.CustomerID=Events.CustomerID) LEFT JOIN EventDetail ON EventDetail.EventID=Events.EventID
WHERE Events.EventDate Between #1/1/2001# And #12/31/2004# And Events.Canceled=0
GROUP BY Customers.CustomerName
I have tried many variations and still come up with the same result. When I break it down into two seperate SQL strings or use a Union Join I get the correct totals, however I would like them as one total and not two.
Any help will be greatly appreciated!
Tom (maxflitom)
I am attempting to summarize customer totals into one amount from two different Access Tables, the Events and EventDetail Tables. The Sum() function from the EventDetail table returns the correct result, however, the amounts returned from the Events Table are duplicated by the amount of entries in the EventDetail Table. There is only one record in the Events Table and could be many in the EventDetail table Here is my SQL string:
SELECT Customers.CustomerName, sum(EventDetail.Quantity*EventDetail.Price+Events.MeetingRoomPrice+Events.Grat11+Events.Grat7+Events.SalesTax) AS EventTotal
FROM (Events INNER JOIN Customers ON Customers.CustomerID=Events.CustomerID) LEFT JOIN EventDetail ON EventDetail.EventID=Events.EventID
WHERE Events.EventDate Between #1/1/2001# And #12/31/2004# And Events.Canceled=0
GROUP BY Customers.CustomerName
I have tried many variations and still come up with the same result. When I break it down into two seperate SQL strings or use a Union Join I get the correct totals, however I would like them as one total and not two.
Any help will be greatly appreciated!
Tom (maxflitom)