I\'m trying to get a percentage of the itemid that are available in a certain area.
Using my query, I get an error ORA-00937: not a single-group group function<
I guess even this helps:
SELECT
distinct areas,
NVL(x.count_item * 100,0) AS Percentage
FROM
allitems a
LEFT OUTER JOIN (
SELECT
( COUNT(a.itemid) / (
SELECT
COUNT(*)
FROM
allitems
) ) AS count_item,
areas AS avl_areas
FROM
allitems a
INNER JOIN currentitems c ON a.itemid = c.itemid
GROUP BY
areas
) x ON x.avl_areas = a.areas
;