I have this code for mysql, and in my table i have date entries in my date field from my date table ....i want to make use with between clause ...below is my sql statement..but it displays nothing even there are dates in between...

SELECT * FROM date WHERE date BETWEEN 2011-01-01 AND 2011-12-31

Whats wrong with this code?


Try with quote.

SELECT * FROM `date` WHERE date BETWEEN '2011-01-01' AND '2011-12-31'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.