Reputation: 6516
I have an sql query which returns result in this way:
id first_date second_date third_date 1 12-AUG-13 04.41.42.658000000 PM 07-JUL-14 10.24.02.188000000 AM 06-JAN-12 11.20.01.148000000 AM 2 11-AUG-12 04.41.42.658000000 PM 06-SEP-13 09.22.02.188000000 AM 04-FEB-12 11.20.01.148000000 AM
How can I get the lowest date for each row so result can be presented in this way?
id lowest_date_for_each_row 1 06-JAN-12 11.20.01.148000000 AM 2 04-FEB-12 11.20.01.148000000 AM
Upvotes: 0
Views: 63
Reputation: 12495
I think the LEAST function should do what you ant:
http://www.techonthenet.com/oracle/functions/least.php
So something like
SELECT id, LEAST(first_date, second_date, third_date) leastDate FROM datesTable
Upvotes: 1