I have a table with a lot of datetimes.
ORDER BY dtField DESC
How can I make a SELECT query that returns me a single row:
select...from MyTable......where dtField = 'SomeDate'
- If SomeDate exists, I get that.
- If SomeDate doesn´t exist, I get the date that happened just before that.
F.EX select.....from MyTable where dtField = '2007-05-22' -- returns me the date 2007-05-22
F.EX select.....from MyTable where dtField = ' 2007-05-20' -- returns me the date2007-05-18 (because ' 2007-05-20' doesn't exist)
Does anybody know how to do this?