I have to write a Sql Query like
if the input date is not there in the database then assign the date nearest previous date
that is there in the database.
Ex: I have dates like 12/31/2009, 1/31/2010 in the database
if my input date is 1/21/2010, then i need to check if that date is there in the table
if it is not there then get the nearest previous date i,e 12/31/2009 and assing to the input
Please help me on this.