Doesn't MySQL have the DAY function?
BTW: there's no need for the cfqueryparams, and you should be using a WHERE
clause
<cfquery ...>
SELECT TicketID
FROM Tickets
WHERE MONTH(dateCreated) >= #DatePart("m", f_date)#
AND YEAR(dateCreated) >= #DatePart("yyyy", f_date)#
AND DAY(dateCreated) >= #DatePart("d", f_date)#
ORDER BY TicketID
</cfquery>
Taz
----- Original Message -----
From: "Cedric Villat" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, December 24, 2002 6:00 AM
Subject: Date Compare in SQL?
> I'm trying to compare dates in my SQL statement. I can compare month and
> year, but not day. Here is my query.
>
> <cfquery name="getTicketCount" datasource="#request.dsn#"
> username="#request.dbuser#" password="#request.dbpass#">
> SELECT T.ticketID
> FROM Tickets T
> AND month(dateCreated) >= <cfqueryparam cfsqltype="CF_SQL_INTEGER"
> value="#DatePart("m", f_date)#">
> AND year(dateCreated) >= <cfqueryparam cfsqltype="CF_SQL_INTEGER"
> value="#DatePart("yyyy", f_date)#">
> ORDER BY T.ticketID
> </cfquery>
>
> but how can I compare the Day? I'm looking for something that will work on
> MySQL as well as MSSQL. Any ideas?
>
> Cedric
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com