I have this query that should:
create a listing that identifies different items in the inventory
table on the number of colors available for each option
But I’m getting an error saying:
Error at Command Line:167 Column:66 Error report: SQL Error:
ORA-00904: “INV”.”ITEM_ID”: invalid identifier
00904. 00000 – “%s: invalid identifier”
SELECT inv.inv_id,
item1.item_id,
(SELECT COUNT(*)
FROM (SELECT DISTINCT i.color FROM inventory i WHERE i.item_id = inv.item_id))
FROM inventory inv
INNER JOIN item item1
ON item1.item_id = inv.item_id
GROUP BY inv.inv_id, item1.item_id;
It sounds like you just want
There doesn’t seem to be any reason to hit the
inventorytable again in a subquery.