You really shouldn't be looping over a query like this. Given the code provided by the other user, your final SQL might look like this:
SELECT * FROM purchases WHERE year IN (2001,2004,2006) ORDER BY orderid desc That's what you're looking to accomplish. Now you just need to determine where the years are coming from and go from there. Assuming you have a form which allows you to enter a start and end year, then your SQL could look like this: SELECT * FROM purchases WHERE year BETWEEN '#FORM.start#' AND '#FORM.end#' ORDER BY orderid desc That would give you all records with years between the two provided. <!----------------//------ andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --------------//---------> -----Original Message----- From: Orlini, Robert [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 18, 2006 10:07 AM To: CF-Talk Subject: Select/combine two years I wrote a search form to search for different years. I'm using cfloop and would like a user to be able to display different years in their search. So far it just shows one year at a time. I'm not a daily CF programmer so I'm a bit stick here. Any help appreciated. Robert O. Here is what I have: <cfloop list="#form.year#" index="i"> <cfquery name="getlist" dataSource="printprices"> SELECT * FROM purchases where year = '#i#' order by orderid desc </cfquery> </cfloop> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:257220 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

