How can I modify the query below to show "average dollar value for Orders"
and "average dollar value for OrderItems"
side by side in columns. The query below would combine them. Thank you.
SELECT (COUNT(Orders.orderid) / SUM(Inventory.price)) AS Orders_Average
FROM ORDERITEMS LEFT OUTER JOIN
Inventory ON OrderItems.partid = Inventory.partid RIGHT OUTER JOIN
Orders ON OrderItems.orderid = Orders.orderid
WHERE NOT EXISTS
WHERE OrderItems.orderid <> Orders.orderid
GROUP BY ORDERITEMS.orderid)
For average you need to do Sum over count and not count/sum.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)