Use of SQL PIVOT
Hello. I'm trying to use PIVOT to get a column-based result, not a row-based result.
This isn't the actual data source, but is being simplified to ask the question here.
This query works and produces 10 columns:
SELECT *
FROM (SELECT lookup_code
FROM fnd_lookups
WHERE lookup_type = 'POS_BUSINESS_CLASSIFICATIONS'
)
PIVOT (COUNT(lookup_code)
FOR lookup_code
IN ('000', '001', '002', '003', '004', '005', '006', '007', '008', '009')
)
Multiple Oracle pages that I've looked at say you can replace that hardcoded list with the word any , or put it into a query. One such page is here: