Having a bit of trouble with this.
Need to find the record with the 'earliest date', with the year irrelevant.
So if my table has
03-07-80 (DD-MM-YY)
06-12-12
23-01-90
Then 23-01 should be the earliest date.
This works, but only finding the minimum date, not just the DD and MM part.
select min(date1), year1
from table
where date1 = ( select min(date1)
from table
)
group by year1, date1;
If I try changing it to
select to_char(min(date1),'DD-MM'), year1
from table
where date1 = ( select to_char(min(date1),'DD-MM')
from table
)
group by year1, date1;
I get an invalid month error? And I'm not 100% sure on whether the to_char(min(date1),'DD-MM' is the right way to do it.
Any help would be much appreciated.