Bharanikumar
Bharanikumar

Reputation: 25733

date between query does not return exact result

This query does not return the records on jan , but it return records on 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 is the DATE type

Upvotes: 0

Views: 224

Answers (1)

Pekka
Pekka

Reputation: 449713

MySQL's date format is YYYY-MM-DD. Try

EventDate between '2011-01-01' AND '2011-20-02'

Upvotes: 1

Related Questions