Showing posts with label Mysql Declaration. Show all posts
Showing posts with label Mysql Declaration. Show all posts

Tuesday, 28 August 2018

The mysql declaration does not return the correct result

I have a mysql row with 'date = 2013-05-02, type = 1' etc.

Then I run this query
SELECT date, type, status, rate
FROM reservation
WHERE  type = 1
AND date BETWEEN 2013-05-01 AND 2013-05-08
ORDER BY date asc
LIMIT 0, 10

But this returns empty results. What is the query issue here?

Put the dates in quotes ' in the mysql query.
SELECT date, type, status, rate
FROM reservation
WHERE  type = 1
AND date BETWEEN '2013-05-01' AND '2013-05-08'
ORDER BY date ASC
LIMIT 0, 10 ;