[AccessD] SQL: Sum from the third table

Marcus, Scott (GEAE, Contractor) scott.marcus at ae.ge.com
Wed Jul 23 08:11:41 CDT 2003


To properly answer this question, it would be helpful to have some data and
an example of what kind of output you are looking for with that data. I'm
not sure what you are asking based on the table structure. 
 
Scott

-----Original Message-----
From: Ervin Brindza [mailto:viner at eunet.yu]
Sent: Wednesday, July 23, 2003 8:57 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] SQL: Sum from the third table


 

----- Original Message ----- 
From: Marcus,  <mailto:scott.marcus at ae.ge.com> Scott (GEAE, Contractor) 
To: 'Access Developers discussion and  <mailto:accessd at databaseadvisors.com>
problem solving' 
Sent: 23 July, 2003 1:41 PM
Subject: RE: [AccessD] SQL: Sum from the third table

Ervin,
 
SELECT Customer.CustID,
             Customer.Name,
             Sum(Order.ValAmount) AS UkVred,
             Sum(OrderDet.Quantity) AS ukkol
FROM (Customer INNER JOIN [Order] ON Customer.CustID = Order.CustID)
           INNER JOIN OrderDet ON Order.RedBROJ = OrderDet.RedBROJ
GROUP BY Customer.CustID, Customer.Name;
 
Hope this helps.
 
Scott

 
Sorry, but the same. E.g. if there are 1 order for the customer, with e.g. 3
items, the field UkVred contain 3 times the ValAmount. It's weird?
Thanks,
    Ervin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030723/a24765eb/attachment-0001.html>


More information about the AccessD mailing list