Similar to rows-to-col(EAV to relational) - SQL query please, contd
This question is related to:
As suggested in that forum we are in the process of restructuring the schema. But as we have to support existing app, I would like to ask another related question:
Data is in the following format:
And I need in following format:
PROD_QTY is not involved now. PROD_KEY need to be placed in their respective column based on EN_NO as shown above. Tried out GROUP BY with CASE but to no avail. Suggestions??
If your using oracle 11g then pivot may be of some use: http://www.oracle.com/technetwork/articles/sql/11g-pivot-097235.html