MySQL: How to get the Particular Data Range
If we want to fetch the data with in a particular Date range then we can use the INTERVAL keyword.
For example,
Let’s say I want to fetch the records which have been inserted with in last 10 days that means the records which are added with in 21/7/2009 to 30/07/2009(30/07/2009 is Totay’s Date) then the query will be like this:
|
SELECT * FROM tbl_name WHERE dateOfCreation >= CURDATE() – INTERVAL 9 DAY;
|
0 comments:
Post a Comment