Associate
- Joined
- 31 Dec 2002
- Posts
- 458
Hi, I have a table that lists Order Numbers and Order Items for each order number. I am trying to work out the average number of items per order, but am stuck in aggregate function errors. So for example there are 11 order items in total, and there are 4 different order numbers (with some listed multiple times), my calculation should calculate 11 / 4. I tried the following:
Any ideas anyone? Cheers.
Code:
SELECT count(OrderItems) /count (DISTINCT OrderNumbers) AS AverageItems FROM tblOrders;
Any ideas anyone? Cheers.
Last edited: