[EMAIL PROTECTED] wrote:
> All,
>
> I'm trying to take the records/coupons that match the first query criteria and
> pass them to the second query where cookie.id and coupon.id match.
>
> PROBLEM:
> I'm getting all the coupon.id(s) in one long bunch. So instead of being able
> to
> apply each id in the query, I get all the ids.
>
> QUESTION: How can I isolate each id byself to be used in the seond query?
>
Not real clear where the logic of your code is going, and Ben's
suggestion of setting a temporary variable for use in the inner query
may work fine for you...but you also might want to look at re-writing
your first query to include the data from the secondary queries through
a outer join...then you would just have one cfoutput(and one trip to the
db)...
<CFQUERY Name="Coupons" datasource="#datasource#">
SELECT a.id, a.refreshdays, b.couponid, b.lastdownloaddate
FROM Coupons a LEFT JOIN UserCoupons b ON a.id = b.couponid AND b.userid
= 18884
WHERE a.StartDate <= #CreateODBCDateTime(Now())# and a.EndDate >=
#CreateODBCDateTime(Now())# and a.CompanyID = 1
ORDER BY a.CouponOrder ASC
</CFQUERY>
<CFOUTPUT Query="Coupons">
....some code...
<cfif (len(couponid) IS 0) OR (DateDiff('D', LastDownloadDate,
(DateFormat(Now(),"mm/dd/yyyy"))) GTE RefreshDays)>
<cfset couponflag = 0>
</cfif>
....some more code...
</CFOUTPUT>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:257095
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4