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


Please Help Members By Posting Answers For Below Questions

What is prepared statement in sql?

551


Does truncate need commit?

519


what is column? : Sql dba

576


how to calculate the difference between two dates? : Sql dba

550


Can a foreign key be a duplicate?

510






What is cursor status?

765


What is java sql drivermanager?

551


Explain alias in sql?

585


GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?

2577


Why stored procedure is better than query?

512


How do rank () and dense_rank () differ?

523


What is the life of an sql statement?

527


How to select 10 records from a table?

650


Is sqlite good enough for production?

535


Is postgresql a nosql database?

537