Friday, 22 April 2016

How to get data between 2 dates in MySQL ?


STEP 1. Identify the start date and the end date to fetch the record (Date format : yyyy-MM-dd)
For example : To get the records of 10-jan-2013
Start date = ‘2013-01-10'
End date = '2013-01-11'


STEP 2. Fetch the records between 2 dates using BETWEEN in WHERE clause :
SELECT * FROM logs WHERE issueDate BETWEEN '2013-01-10' AND '2013-01-11'

No comments:

Post a Comment

Note: only a member of this blog may post a comment.