SELECT *
FROM events
WHERE day(theDate) = '#dayVal#' and month(theDate) = '#session.month#' and year(theDate) = '#session.year#'
Can the day() function be used in this way in the WHERE statement?
Yes, but only from version 4.1.1
Use DayOfMonth() or preferably Extract() (which is the method from the SQL standard) per the manual.
Is there a better way to achieve this?
Loose the single quotes and start using cfqueryparam.
Jochem
-- I don't get it immigrants don't work and steal our jobs - Loesje
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]