Newbie to SQL. SQL works, but what I'm hoping for is one line for all orders for a country. Currently get this:
Australia 1201 22.23
Australia 1233 90.55
Belgium 2344 88.07
Belgium 2348 12.67
Can't think what I need to GROUP BY to get it.
------------------
SELECT
CLASSICMODELS.CUSTOMERS.COUNTRY,
CLASSICMODELS.ORDERS.ORDERNUMBER,
SUM (CLASSICMODELS.ORDERDETAILS.QUANTITYORDERED *
CLASSICMODELS.ORDERDETAILS.PRICEEACH) AS LT
from
CLASSICMODELS.CUSTOMERS,
CLASSICMODELS.ORDERDETAILS,
CLASSICMODELS.ORDERS
WHERE
CLASSICMODELS.CUSTOMERS.CUSTOMERNUMBER =
CLASSICMODELS.ORDERS.CUSTOMERNUMBER
AND
CLASSICMODELS.ORDERS.ORDERNUMBER =
CLASSICMODELS.ORDERDETAILS.ORDERNUMBER
GROUP BY
CLASSICMODELS.CUSTOMERS.COUNTRY,
CLASSICMODELS.ORDERS.ORDERNUMBER,
ORDER BY
CLASSICMODELS.CUSTOMERS.COUNTRY
Australia 1201 22.23
Australia 1233 90.55
Belgium 2344 88.07
Belgium 2348 12.67
Can't think what I need to GROUP BY to get it.
------------------
SELECT
CLASSICMODELS.CUSTOMERS.COUNTRY,
CLASSICMODELS.ORDERS.ORDERNUMBER,
SUM (CLASSICMODELS.ORDERDETAILS.QUANTITYORDERED *
CLASSICMODELS.ORDERDETAILS.PRICEEACH) AS LT
from
CLASSICMODELS.CUSTOMERS,
CLASSICMODELS.ORDERDETAILS,
CLASSICMODELS.ORDERS
WHERE
CLASSICMODELS.CUSTOMERS.CUSTOMERNUMBER =
CLASSICMODELS.ORDERS.CUSTOMERNUMBER
AND
CLASSICMODELS.ORDERS.ORDERNUMBER =
CLASSICMODELS.ORDERDETAILS.ORDERNUMBER
GROUP BY
CLASSICMODELS.CUSTOMERS.COUNTRY,
CLASSICMODELS.ORDERS.ORDERNUMBER,
ORDER BY
CLASSICMODELS.CUSTOMERS.COUNTRY