Skip to content
Advertisement

Pivot Issue ORA-00918 column ambiguously defined

I am running the below query and need to output the rows as columns. When I am adding the second MAX statement, I am getting an error ORA-00918 column ambiguously defined. Not sure what I am doing wrong. Any help will be appreciated.

Advertisement

Answer

You probably need something like this

I.e. 1) add alias to you pivot labels

  1. do not multiplicate the MAX calculation, it it the responsibility of PIVOT to calculate max for each label.
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement