Click to See Complete Forum and Search --> : Querying by date in MySQL


tarsus
10-05-2006, 01:04 PM
Can someone tell me why this query is returning records with a date before the specified one?

SELECT * FROM calendar WHERE cal_date >= 2006-10-05 ORDER BY cal_date, cal_st_time, cal_end_time

cal_date has the data type "date". The query is returning a record with a value of 2006-09-18 in this field.

tarsus
10-05-2006, 02:08 PM
Apparently the solution was to make the comparison date a string:

SELECT * FROM calendar WHERE cal_date >= '2006-10-05' ORDER BY cal_date, cal_st_time, cal_end_time