I have this query:
Select To_Char(Order.Date, 'IW') As "Week No",
Order.User As "User",
Count(Order.OrderNo) As "Total Orders",
Sum(Order_Totals.Qty) As "Total Items",
From Order Order,
Order_Totals Order_Totals
Where Order.OrderNo = Order_Totals.OrderNo
And (Order.Date Between '01-JAN-15' And '31-DEC-15')
Group By Order.User
But it throws the error message:
Not a valid GROUP BY expression
I want to show how many orders and items each user has created each week this year, looking at http://www.techonthenet.com/oracle/group_by.php I thought that I am using GROUP BY
correctly, but clearly not and I am not sure how I can sort it.
Best Answer
You have to add
To_Char(Order.Date, 'IW')
in theGROUP BY
too.