[AccessD] SQL: Sum from the third table

Ervin Brindza viner at eunet.yu
Thu Jul 24 03:05:36 CDT 2003


> 
> SELECT Q1.CustID, CustName,UKKol,UKVRed
> FROM 
> (SELECT CustName, CustID, Sum(Quantity) AS UKKol
> FROM Customer 
>     INNER JOIN Orders ON Customer.CustID = Orders.CustID
>     INNER JOIN OrderDet ON Orders.REDBROJ = OrderDet.Redbroj
> GROUP BY CustName, CustID) as Q1
> 
>  INNER JOIN
> 
> (SELECT  CustID, Sum(ValAmount) AS UKVRed
> FROM Customer 
>    INNER JOIN Orders ON Customer.CustID = Orders.CustID
> GROUP BY CustName, CustID) as Q2
> 
>      ON Q1.CustID = Q2.CustID
> 

Stuart,
many thanks for the help, but the part:
SELECT CustName, CustID, Sum(Quantity) AS UKKol
 FROM Customer 
     INNER JOIN Orders ON Customer.CustID = Orders.CustID
     INNER JOIN OrderDet ON Orders.REDBROJ = OrderDet.Redbroj
 GROUP BY CustName, CustID
seems to fail :( 
Error message is: Syntax error(missing operator)
Can you help me before you go to drink beer ? ;-)
Best regards,
    Ervin





More information about the AccessD mailing list