How can u find column name from a table which have max value
in a row.( not max value)
Answer Posted / gaurav
select decode( (select sal from emp where empno = 7521) , (select greatest( sal, comm ) from emp where empno = 7521 ), 'sal', 'comm' ) from dual
You can use multiple decode if more number of columns are there.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is sap sql anywhere?
how can we know the count/number of elements of an array? : Sql dba
what are rollup and cube in t-sql? : Transact sql
What is the syntax to add a record to a table?
What is rowtype?
What is the difference between instead of trigger and after trigger?
Why we use joins in sql?
What is sql stand for?
what is a view? : Sql dba
How do I truncate a sql log file?
what are all the different types of indexes? : Sql dba
Is merge a dml statement?
Does view store data in sql?
How many disk partitions should I have?
How do you select unique values in sql?