Hi Janet, I tried this and it didn't work... ?
-- Scott Stewart ColdFusion Developer SSTWebworks 4405 Oakshyre Way Raleigh, NC. 27616 (703) 220-2835 http://www.sstwebworks.com http://www.linkedin.com/in/sstwebworks -----Original Message----- From: Janet MacKay [mailto:[EMAIL PROTECTED] Sent: Saturday, September 22, 2007 3:30 PM To: CF-Talk Subject: Re: one for the SQL gurus >AND (Active = 1) and category in >(SELECT category >FROM dbo.PsycBOOKS ><cfif categories is not "">where Category in ('0' > <cfloop >list="#categories#" index="x"> > ,'#x#' ></cfloop>) ></cfif> >) Why the subquery? Just use IN with cfqueryparam list="true" SELECT LEFT(PublicationYear, 4) AS [Year], COUNT(PBID) AS BookCount FROM dbo.PsycBOOKS WHERE IsNumeric(PublicationYear) = 1 AND Active = 1 <cfif categories is not ""> AND Category IN ( <!--- .. or use listAppend(categories, "0") ---> <cfqueryparam value="#categories#" list="true" cfsqltype="..."> ) </cfif> GROUP BY LEFT(PublicationYear, 4) ORDER BY [Year] desc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Check out the new features and enhancements in the latest product release - download the "What's New PDF" now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289205 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4