RE: Simple Query Help
You're one fine CF man. Thanks. Rick -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 05 February, 2003 10:45 To: CF-Talk Subject: Re: Simple Query Help cfquery name=Q_Month datasource=command_calendar SELECT Title, Details, EventDate, StartHour, StartMin FROM Events WHERE EXTRACT (YEAR FROM EventDate) = cfqueryparam cfsqltype=cf_sql_integer value=#Year(Now())# AND EXTRACT (MONTH FROM EventDate) = cfqueryparam cfsqltype=cf_sql_integer value=#Month(Now())# ORDER BY EventDate ASC /cfquery Jochem ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Simple Query Help
Rick, You might find that you can use : Year(EventDate) = #Year(Now())# rather than EXTRACT (YEAR FROM EventDate) = cfqueryparam cfsqltype=cf_sql_integer value=#Year(Now())# Depends on the database you're using. You can use the cfqueryparam in both versions of the SQL statement. Just thought I'd get rid of it as Year(Now()) will return an integer. Regards Stephen - Original Message - From: Jochem van Dieten [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, February 05, 2003 2:45 PM Subject: Re: Simple Query Help cfquery name=Q_Month datasource=command_calendar SELECT Title, Details, EventDate, StartHour, StartMin FROM Events WHERE EXTRACT (YEAR FROM EventDate) = cfqueryparam cfsqltype=cf_sql_integer value=#Year(Now())# AND EXTRACT (MONTH FROM EventDate) = cfqueryparam cfsqltype=cf_sql_integer value=#Month(Now())# ORDER BY EventDate ASC /cfquery Jochem ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Simple Query Help
I need to parse a query to a calendar database that returns just the current month's events, and I'm hung up on the Where part of the query (I'm obiously also getting very confused between CF and SQL functions). cfquery name=Q_Month datasource=command_calendar SELECT Title, Details, EventDate, StartHour, StartMin FROMEvents WHERE DatePart(,EventDate) = AND DatePart(,EventDate)= ORDER BY EventDate ASC /cfquery Am I on the right track here? Is there a better way? ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Simple Query Help
Yep you are... WHEREDatePart(,EventDate) = AND DatePart(,EventDate)= This will not work... the first part of the Where clause needs to be something like WHERE EventDate = '[YOURDATE]' I am not sure what format your date is in, but I think you get the idea :-p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 05 February 2003 14:38 To: CF-Talk Subject: Simple Query Help I need to parse a query to a calendar database that returns just the current month's events, and I'm hung up on the Where part of the query (I'm obiously also getting very confused between CF and SQL functions). cfquery name=Q_Month datasource=command_calendar SELECT Title, Details, EventDate, StartHour, StartMin FROMEvents WHERE DatePart(,EventDate) = AND DatePart(,EventDate)= ORDER BY EventDate ASC /cfquery Am I on the right track here? Is there a better way? ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Simple Query Help
cfquery name=Q_Month datasource=command_calendar SELECT Title, Details, EventDate, StartHour, StartMin FROM Events WHERE EXTRACT (YEAR FROM EventDate) = cfqueryparam cfsqltype=cf_sql_integer value=#Year(Now())# AND EXTRACT (MONTH FROM EventDate) = cfqueryparam cfsqltype=cf_sql_integer value=#Month(Now())# ORDER BY EventDate ASC /cfquery Jochem ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4