I want to make a MySql selection for a period of time. but i didn't figure it out how to make it correctly.
this is what i tried
SELECT * FROM rapoa开发者_Go百科rte WHERE DATE(ziua) BETWEEN 2010-01-12 AND 2011-01-14
Can you please help?
thanks, Sebastian
If performance is an issue I would avoid using DATE
in this way as it will prevent efficient usage of an index and will result in a full scan. For small tables this might not be a problem but if your table is large you will probably find that this gives better performance:
SELECT *
FROM rapoarte
WHERE ziua >= '2010-01-12'
AND ziua < '2010-01-15'
SELECT * FROM rapoarte WHERE DATE(ziua) BETWEEN "2010-01-12" AND "2011-01-14"
精彩评论