You're right. My dates in the table look like "04/04/2004" I need to compare not the exact date but the month.


That's why I was isolating the first two chars which signify the month.


Robert O.

-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 3:59 PM
To: CF-Talk
Subject: RE: Query date

you need to compare a date in your database to a cf generated date?

<cfquery name="report" datasource="wweb_status_internal">
<!--- Select top 1 * lists first record--->
Select *
>From maintenance_report
Where id = id and maint_report_date = '#dateFormat(Now(),'mm')#'
Order by id desc
</cfquery>

assuming the date field is maint_report_date.

not sure about the data layout, so its hard to comment, but you should
get the picture from this...if this is correct, you need to have dates
in your database set up differently.

but you could also do a

where id = id and maint_report_date between '' and ''

where you fill '' and '' with a begin and end date...dont fool around
with stripping the first two chars. off...thats kludgy..

....tony

Tony Weeg
sr. web applications architect
navtrak, inc.
[EMAIL PROTECTED]
410.548.2337
www.navtrak.net

-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 15, 2004 3:50 PM
To: CF-Talk
Subject: Query date

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. I know my Where comparison on the date is
wrong. Any ideas please?

Thanx...as always...especially today.

Robert HWW
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to