[AccessD] SQL: Sum from the third table

Ervin Brindza viner at eunet.yu
Wed Jul 23 07:57:23 CDT 2003


  ----- Original Message ----- 
  From: Marcus, Scott (GEAE, Contractor) 
  To: 'Access Developers discussion and 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/5cfc688d/attachment-0001.html>


More information about the AccessD mailing list