date , rate
1/2/2014 12:15:00.0000 PM, abc
8/2/2014 12:15:00.0000 PM, efg
etc...
let say i have data that are updated once a week,for example:1/2/2014 is the update date, and the second week will be 8/2/2014 etc... condition: i want to write a code in sql,if the client choose the day in 4/2/2014 and it will choose to show the data in 1/2/2014.
i have tried the query more or less like this:
SELECT rate,date FROM mytable WHERE year(date)=2014 AND month(date)=2 AND day(date)=4
but it give me empty data since there is no data at 4/2/2014 and i want the query can show the data from the previous date which is 1/2/2014