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 |
In a table only one column how to update rows
How will you delete a particular row from a Table?
How many sectors are in a partition?
If i can use sys.check_constraints to display my constraints from my database using sql server 2005, how can i display then if i am using sql server 2000????
Is primary key a clustered index?
What is the difference between execution of triggers and stored procedures?
How delete a row in sql?
What is sqlcommand?
What is a mutating table and a constraining table?
please explain database architecture..
How do we accept inputs from user during runtime?
How to add, remove, modify users using sql?