Comparing dates are fun - here's a couple suggestions:
-check your formatting of the date object you're comparing and format your
where-clause date to be exactly the same format as appears in the DB (i.e.
smalldate time, ODBC d/t obj. etc.); relying on the auto conversion within
ODBC has yielded unpredictable results for me...
-Make sure it's a Date/Time object in the DB...
-Pass in (as defaults if necessary) all date/time elements that exist in the
DB data (i.e. if seconds exist, have them in the compare value even if its
:00...
-If you want all games later than today, get rid of the = in your where
clause(s)
-If you only want the next (1) record, use the "top" function in the SQL to
get the first record
-It will help performance if you set up an index on your dates in the DB
table...
Hope these quick comments help. If I think of others I'll post 'em!
Truman
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 09, 2001 12:53 PM
To: CF-Talk
Subject: QUERY PROBLEM
I am trying to pull the next baseball game from a schedule I have in an
Access database. When it processes it pulls the next game to a degree. If
there is a game today it will not pull that game. Example there is a game
today 4/9/2001 and the ext game it displays is 4/10/2001 Any ideas?
<cfset today = dateformat(NOW(), 'm/d/yyyy')>
<CFQUERY name="NextGame" datasource="#dsource#" maxrows="1">
SELECT *
FROM schedule
WHERE gdate >= #today#
</CFQUERY>
ALSO HAD IT AS
<CFQUERY name="NextGame" datasource="#dsource#" maxrows="1">
SELECT *
FROM schedule
WHERE gdate >= NOW()
</CFQUERY>
Thanks.
Brian Hasselback
[EMAIL PROTECTED]
http://www.intent.net
http://www.hasselback.com
Web Hosting & Development
(502) 452-1851
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists