Ryan,

If the time is not specified in your selection criteria, SQL defaults it to
00:00 midnight. You aren't receiving any results because the none of your
articles were probably created at midnight.  So you have a couple different
options for display, two of these could be displaying all news forward from
midnight, or using a BETWEEN to specify a date range for the selected
records.  To select news on that day and forward, you could do something
like this:

<CFQUERY Datasource="Athlonmb" Name="WebNewsData" MaxRows=30>
SELECT dbo.News.NewsID, dbo.News.Title, dbo.News.Date, dbo.News.Author, 
dbo.News.Source, dbo.News.Link, dbo.News.Information, dbo.News.Status, 
dbo.Authors.AuthorID, dbo.Authors.AuthorName, dbo.Authors.AuthorEmail
FROM News, Authors
WHERE (dbo.News.Author = dbo.Authors.AuthorID) AND 
(dbo.News.Status => 2)
AND (dbo.News.Date >= #CreateODBCDateTime(NewsDate)#)
ORDER BY dbo.News.Date DESC
</cfquery>

OR for selection of that day only:

<!--- Set end date one day forward --->
<cfset EndDate = DateFormat(#NewsDate#+1)>
<!--- Perform query. --->
<CFQUERY Datasource="Athlonmb" Name="WebNewsData" MaxRows=30>
SELECT dbo.News.NewsID, dbo.News.Title, dbo.News.Date, dbo.News.Author, 
dbo.News.Source, dbo.News.Link, dbo.News.Information, dbo.News.Status, 
dbo.Authors.AuthorID, dbo.Authors.AuthorName, dbo.Authors.AuthorEmail
FROM News, Authors
WHERE (dbo.News.Author = dbo.Authors.AuthorID) AND 
(dbo.News.Status => 2)
AND dbo.News.Date BETWEEN #CreateODBCDateTime(NewsDate)# AND
#CreateODBCDateTime(endDate)#
ORDER BY dbo.News.Date DESC
</cfquery>

Regards,
Ryan

Ryan Hill, MCSE
Director, Systems Integration
Market Matrix, Inc.
http://www.marketmatrix.com 

> -----Original Message-----
> From: Ryan Shrout [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 26, 2000 12:05 PM
> To: [EMAIL PROTECTED]
> Subject: Desperate With Comparing Dates in CFQUERY
> 
> 
> This is a multi-part message in MIME format.
> 
> ------=_NextPart_000_003D_01BFAF91.1A170C20
> Content-Type: text/plain;
>       charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> 
> Ok, the first time I posted this, I didn't get any responces, so I'm =
> going to try to better explain the problem.  Here goes:
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
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