Home » RDBMS Server » Networking and Gateways » getting max date from multiple columns
getting max date from multiple columns [message #66507] Wed, 10 July 2002 12:29 Go to next message
Richie
Messages: 1
Registered: July 2002
Junior Member
I have a table with 3 columns(A, B, C)....each is filled with dates.....is there a way to find the maximum date out of all three columns and return it?
Thanks :)
Rich
Re: getting max date from multiple columns [message #66508 is a reply to message #66507] Wed, 10 July 2002 18:55 Go to previous message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
SQL> select * from e2;

D1        D2        D3
--------- --------- ---------
02-JUN-99 03-JUN-99 04-JUN-99
20-FEB-81 21-FEB-81 22-FEB-81
22-FEB-81 23-FEB-81 24-FEB-81
02-APR-81 03-APR-81 04-APR-81
28-SEP-81 29-SEP-81 30-SEP-81
01-MAY-81 02-MAY-81 03-MAY-81
09-JUN-81 10-JUN-81 11-JUN-81
19-APR-87 20-APR-87 21-APR-87
17-NOV-81 18-NOV-81 19-NOV-81
08-SEP-81 09-SEP-81 10-SEP-81
23-MAY-87 24-MAY-87 25-MAY-87
03-DEC-81 04-DEC-81 05-DEC-81
03-DEC-81 04-DEC-81 05-DEC-81
23-JAN-82 24-JAN-82 25-JAN-82

14 rows selected.

SQL> select greatesT(max(d1),max(d2),max(d3)) from e2;

GREATEST(
---------
04-JUN-99

SQL> 
Previous Topic: sql
Next Topic: Re: Transparent Gateway
Goto Forum:
  


Current Time: Thu Nov 21 16:01:33 CST 2024