Rakesh
Rakesh

Reputation: 594

Oracle pivot error

Hi i've the below query in oracle to get data. it is working fine in sql server, but, when i tried to execute this in oracle it is giving and error.

    SELECT PRODUCT, FRED, KATE FROM (
    SELECT CUST, PRODUCT, QTY
    FROM Product
    )
    PIVOT
    (
    SUM(QTY) FOR CUST IN (FRED, KATE)
    )
    ORDER BY Product

Error:

enter image description here

and the table o/p is as below

enter image description here

Thanks

Upvotes: 0

Views: 410

Answers (1)

Kirill Leontev
Kirill Leontev

Reputation: 10941

Try SUM(QTY) FOR CUST IN ('FRED' as fred , 'KATE' as kate)

Upvotes: 2

Related Questions