DATE_FORMAT() question

wxdqz

New Member
Hi there people:

I've used DATE_FORMAT() successfully a bunch of times when querying my MySQL DB, so why do records whose date's are *LESS* than '$search_date' still get displayed in the example below?

//----The query:

$sql = "SELECT id,accept,teamname,sport,level,location,DATE_FORMAT(dateset,'%d-%m-%Y') AS thedate FROM $table2 WHERE DATE_FORMAT(dateset, '%d-%m-%Y')>'$search_date' AND accept!='closed' ORDER BY '$sort' ";

The column type is DATETIME on MySQL3.23.36-log.

Could it be that DATE_FORMAT() isn't allowed in a WHERE clause? (The manual doesn't mention this though, and no error is thrown up..)

Many thanks for any pointers.
Russ
 
Back
Top