0

My goal is to get max value for each row. For instance, my table has two columns, and the desired output is, 80,70 and 90 for each row.

I tried this code "SELECT MAX(column1, column2) from my_table" , and it showed error such as ORA-00909:invalid number of argumants

[my_table and the desired output]

my_table

MT0
  • 143,790
  • 11
  • 59
  • 117
Soon
  • 491
  • 3
  • 16

1 Answers1

1

Use greatest not max

   with x as (
      select 80 col1, 60 col2 from dual union all
      select 70, 50 from dual union all
      select 80, 90 from dual
    )
    select greatest( col1, col2 )
      from x
Justin Cave
  • 227,342
  • 24
  • 367
  • 384