I'm trying to find out the top sold items from my database, I have 3 tables, se_order
, se_items
, se_ordered_item
. I tried the following SQL but I stuck in the group by issue, I don't see where the error is:
select i.name, count(max(oi.item_id*oi.quantity))
from SE_ORDERED_ITEM oi, se_items i, se_order o
where o.order_id = oi.order_id
and oi.item_id = i.item_id
group by i.name, i.item_id"
I want to list the names of top sold items along with number of these sold items
but I get this error:
ORA-00937: not a single-group group function;
so could any one please help me in this issue
Thanks In Advance
PS, I am using apex oracle environment