I meant to include the SQL DateDiff() function.  Oopps, sorry...

Here's the correct way:

SELECT Date, DateDiff(DAY,Date, GetDate()) AS "DateSpan"
FROM   Dates
ORDER BY DateSpan

Chris
----------------------------------------------
Original Message
From: "Dan Haley"<[EMAIL PROTECTED]>
Subject: RE: SQL ORDER BY Problem
Date: Tue, 5 Sep 2000 09:58:08 -0700 

>This one, just like James' original won't work because you are mixing CF
and
>SQL statements.  CF will try to evaluate the '#datediff(date, now())#' one
>time when it is preparing the SQL to send to the database.  It will not be
>evaluated for each row of the query.  Build your query with CF.  Use SQL
>statements and functions for manipulating each row of the query.
>
>Dan
>
>-----Original Message-----
>From: Chris Terrebonne [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, September 05, 2000 9:45 AM
>To: [EMAIL PROTECTED]
>Subject: Re: SQL ORDER BY Problem
>
>
>SELECT Date, #DateDiff(date, now())# AS "DateSpan"
>FROM   Dates
>ORDER BY DateSpan
>
>
>chris
>
>----------------------------------------------
>Original Message
>From: "David Shadovitz"<[EMAIL PROTECTED]>
>Subject: Re: SQL ORDER BY Problem
>Date: Tue, 5 Sep 2000 06:18:33 -0700
>
>>Wouldn't your results be the same if you just ordered by Date?  You're
>>merely (trying to) subtract a constant from each Date.
>>-David
>>
>>On Tue, 5 Sep 2000 "James Smith" <[EMAIL PROTECTED]> writes:
>>> I have a query that selects dates from a datasource, and I would like 
>>> to
>>> order by the number of days to the next occurrence, but the 
>>> following
>>> doesn't work.
>>> 
>>> SELECT Date
>>> FROM   Dates
>>> ORDER BY #DateDiff(date, now())#
>>________________________________________________________________
>>YOU'RE PAYING TOO MUCH FOR THE INTERNET!
>>Juno now offers FREE Internet Access!
>>Try it today - there's no risk!  For your FREE software, visit:
>>http://dl.www.juno.com/get/tagj.
>>--------------------------------------------------------------------------
-
>---
>>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>>
>
>_____________________________________________
>Free email with personality! Over 200 domains!
>http://www.MyOwnEmail.com
>
>---------------------------------------------------------------------------
-
>--
>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>---------------------------------------------------------------------------
---
>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

_____________________________________________
Free email with personality! Over 200 domains!
http://www.MyOwnEmail.com

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to