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 prepared statement in sql?
Does truncate need commit?
what is column? : Sql dba
how to calculate the difference between two dates? : Sql dba
Can a foreign key be a duplicate?
What is cursor status?
What is java sql drivermanager?
Explain alias in sql?
GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?
Why stored procedure is better than query?
How do rank () and dense_rank () differ?
What is the life of an sql statement?
How to select 10 records from a table?
Is sqlite good enough for production?
Is postgresql a nosql database?