How can u find column name from a table which have max value
in a row.( not max value)
Answers were Sorted based on User's Feedback
Answer / mahalakshmi s
select case when col1>col2 then 'col1' else 'col2' end, greatest(col1,col2) end from table_name;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / 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 |
Answer / ganesh
create table aa_test(
a number,
b number,
c number)
;
select greatest(a,b,c) from aa_test where a=99 ;
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / prashanth
user greatedt function.
Ex select greatest(sal,bonus) from emp where emp_id = 1000;
Is This Answer Correct ? | 2 Yes | 6 No |
How to select the Nth maximum salary from Table Emp in Oracle SQL Plus ?
What are the events on which a database trigger can be based?
what is a record in a database ? : Sql dba
What is the use of time stamp in select statement?
Which command is used to delete a package?
Delete duplicate records in the emp table.
Explain polymorphism in pl/sql.
Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me
what is the command for user data type?
How will you select unique values from a list of records?
Hi all, i have a table as follows empid empname mgrid deptid 1 a 3 4 2 b 1 5 3 c 2 3 4 d 3 6 5 e 4 7 i want the output as empname mgrname a c b a c b d c e d
Name Salary Abc 50000 Abc 50000 xyz 20000 find the max salary using aggregate function?