Robert Orlini wrote:
> I'm doing a comparison of the current date with the date in a table:
>
> <cfquery name="report" datasource="wweb_status_internal">
> <!--- Select top 1 * lists first record--->
> Select *
> From maintenance_report
> Where id = id and "#left(maint_report_date,2)#" = "#dateFormat(Now(), "MM")#"
> Order by id desc
> </cfquery>
>
> I'm isolating the first two chars of the date (i.e. 04/05/2004) lets say "04" and comparing to the month value in the where statement.
>
> I'm getting an: "Cannot use empty object or column names. Use a single space if necessary" error.

That is because you are using double quotes instead of single
quotes, it already fails in the parser stage.

> I know my Where comparison on the date is wrong. Any ideas please?

<cfquery name="report" datasource="wweb_status_internal">
   SELECT *
   FROM maintenance_report
   WHERE EXTRACT(MONTH FROM maint_report_date) = <cfqueryparam
cfsqltype="cf_sql_integer" value="#Month(Now())#">
   ORDER BY id DESC
</cfquery>

Jochem

--
I don't get it
immigrants don't work
and steal our jobs
     - Loesje
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to