I've table with currency rates:
T_RATE_ID T_INPUTDATE T_INPUTTIME T_SINCEDATE
1 27.12.2012 22:41:01 28.12.2012
1 27.12.2012 23:45:21 28.12.2012
1 28.12.2012 21:23:11 29.12.2012
1 28.12.2012 21:40:01 29.12.2012
1 29.12.2012 22:33:49 30.12.2012
1 29.12.2012 23:47:19 30.12.2012
How to select max date and then max time for this date?
Simple SELECT MAX(t_sincedate), MAX(t_inputdate), MAX(t_inputtime)
returns max time in all records (23:47:19)
I want get following results:
1 27.12.2012 23:45:21 28.12.2012
1 28.12.2012 21:40:01 29.12.2012
1 29.12.2012 23:47:19 30.12.2012
UPD: I have a date for wich i search rate. If there is no rate for this date, i take the nearest date.
So in where clause i've where t_sincedate <= sysdate