我有一个包含活动清单的数据库,其格式类似:
Datef Event Location Discipline 10/01/2012 MG Training Brooklands MG
我正在问这个问题,以便在某些日期之间取得结果:
SELECT * FROM events WHERE Discipline IN ( MG ) AND Datef BETWEEN 01/01/2012 AND 31/01/2012
查询过程是正确的,我知道数据库有相关结果,但我没有在管理Sphpmyadmin的查询结果(我刚刚被告知“Yourkou query已经成功执行”。)
我很想知道,是否有任何想法说明为什么这种结果不会恢复?
Update: Putting dates in quotes (e.g. SELECT * FROM events WHERE Discipline IN ( MG ) AND Datef BETWEEN 01/01/2012 AND 31/01/2012) kinda works but there s a bug. I ve certain dates doesn t work. e.g.
SELECT * FROM events WHERE Discipline IN ( COMM ) AND Datef BETWEEN 2012-02-01 AND 2012-02-29shows no results, even though there is an event on 2010-02-01. Is this a peculiarity in the BETWEEN algorithm, or am I still getting my query wrong?