Namal
Namal

Reputation: 2071

mysql statement not return 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?

Upvotes: 0

Views: 44

Answers (2)

draxxxeus
draxxxeus

Reputation: 1523

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 ;

Upvotes: 2

shadrus
shadrus

Reputation: 11

Try BETWEEN '2013-05-01' AND '2013-05-08'

Upvotes: 0

Related Questions