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 |
Is big data nosql?
How can we debug in PL/SQL?
What is a parameter query?
What is coalesce sql?
What is scalar function in sql?
What is the starting oracle error number? What is meant by forward declaration in functions?
What is nvl?
What is difference between sql and excel?
How do you run a query?
What is a heap in sql?
explain access control lists. : Sql dba
What are the parts of a basic sql query?