Lets say we have a DATES table with 3 columns: colYear(YEAR), colMonth(MONTH), colDay(DAY).
Rows are inserted like:
colYear colMonth colDay
1 2 3
2 3 0
4 5 5
4 8 0
1 10 28
I need to find maximum date based on 3 columns. So that in this example right answer will be: 4 years, 8 months and 0 days is maximum (we check years, max are 4s, after that we check months max is 8, so we've found our result).
Is it possible? How to achieve this with sql?