Marco Gil wrote:
> 
> I'm trying to get it so that one of my web pages lists only items that are
> going to expire today.  Here's my query:
> 
> <CFQUERY NAME="Expiring" DATASOURCE="#application.ds#">
> 
> SELECT EntryDate, Items.RetailerID, Items.CategoryID, Items.ListingID,
> CouponText, CouponURL, CouponDesc, Retailer, RetailerIMG, Category, Listing,
> Items.ItemID
> 
> FROM Items, Retailers, Categories, Listings, Coupons
> WHERE Coupons.ExpiryDate <= #CreateODBCDateTime(Now())# AND
>           Coupons.ExpiryDate >= #CreateODBCDateTime(Now())# - 1 AND
>             Items.RetailerID = Retailers.RetailerID AND
>             Items.CategoryID = Categories.CategoryID AND
>             Items.ListingID = Listings.ListingID
>          ORDER BY Retailer
> 
> </CFQUERY>
> 
> However, it lists every single item.  Can anyone please help me with this?
> Thanks so much!

This is what's causing your problem:

Coupons.ExpiryDate >= #CreateODBCDateTime(Now())# - 1

I think that what you want to do is subtract one day from Now(). Set up
a variable before the SQL statement. Set it equal to Now(), then use the
DateAdd function to subtract a day from it. Then put
#CreateODBCDateTime(yourvariable)# in the SQL statement. You may be able
to do this more efficiently by using Evaluate within your SQL statement.
I'm not sure how to do this because I don't have a language reference
with me here.
------------------------------------------------------------------------------
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