I want to build a query to find latest contract date on that particular date.
Contract Date: Tank No
01/05/2014 1
12/05/2014 1
01/06/2014 1
01/07/2014 1
Chosen Date: 21/05/2014
Output Latest Contract Date for 21/05/2014 : 12/05/2014
FYI, I am using MS SQL SERVER 2005 SP4
SELECT MAX([Contract Date]) AS [Contract Date]
FROM Table1
WHERE [Contract Date] <= '21/05/2014'