Home » SQL & PL/SQL » SQL & PL/SQL » How to get a maximum value from multiple columns
icon5.gif  How to get a maximum value from multiple columns [message #220188] Mon, 19 February 2007 06:52 Go to next message
abis123
Messages: 31
Registered: February 2007
Member
I with to get the maximum value (of a date) from multiple columns. How would I go about this?
Re: How to get a maximum value from multiple columns [message #220193 is a reply to message #220188] Mon, 19 February 2007 07:26 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Use greatest.
Re: How to get a maximum value from multiple columns [message #220196 is a reply to message #220188] Mon, 19 February 2007 07:30 Go to previous message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
Giving some scripts to create tables, sample data and expected result is a good idea.

Check whether you want something like this.
select greatest(max(a), max(b)) from
(select sysdate +2 a, sysdate +1 b from dual
union
select sysdate -1, sysdate from dual);
By
Vamsi
Previous Topic: problem with Decode cross tab
Next Topic: Dates between two dates
Goto Forum:
  


Current Time: Sat Dec 10 01:08:20 CST 2016

Total time taken to generate the page: 0.07129 seconds