> Is this a valid query in MySQL 3.xx ?
>
> <cfquery name="There" datasource="ipe">
> SELECT *
> FROM events
> WHERE day(theDate) = '#dayVal#' and month(theDate) =
> '#querymonth#' and
> year(theDate) = '#session.year#'
> </cfquery>

Day() can not be used in MySQL WHERE clause

Use To_Days() to convert both dates, here's an example:

To_Days(Post_Date) - To_Days('#DateFormat(ThisRunDate, "YYYY-MM-DD")#') <=
#DaysInMonth(Month(RunDate))#
To_Days(Post_Date) - To_Days('#DateFormat(ThisRunDate, "YYYY-MM-DD")#') > 0

This will show all records within the month of the date specified by
"ThisRunDate".  MySQL 4.1.1 is introducing the DateDiff, DateAdd and
DatePart functions, but it's still in beta and won't be available for a
while.

Good Luck!
Hatton

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.561 / Virus Database: 353 - Release Date: 1/13/2004
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to