此查询不会返回jan上的记录,但会返回feb上的记录
SELECT EventAsstCharged,CustomerName,EventID ,EventName,EventExpectedCharges,EventActuallyCharged,EventUserCharged,date_format(EventDate,'%d-%m-%Y') as EventDate ,EventTime
FROM tblevent
WHERE Status=1 AND date_format(EventDate,'%d-%m-%Y') between '01-01-2011' AND '20-02-2011' AND EntryUser=2 AND Status=1
ORDER BY EventID DESC
EventDate是DATE类型
答案 0 :(得分:1)
MySQL的日期格式为YYYY-MM-DD
。尝试
EventDate between '2011-01-01' AND '2011-20-02'