why not do it at the DB level? <cfquery name="GetProductTypes" datasource="#request.dsn#" dbtype="ODBC" username="#username#" password="#password#"> SELECT DISTINCT producttypes.Code, producttypes.ID, producttypes.SortOrder, products.ProductCategoryID, products.ProductTypeID, products.OrderOnlineStatus FROM producttypes, products WHERE products.ProductCategoryID = 28 AND producttypes.ID = products.ProductTypeID AND products.OrderOnlineStatus = 1
AND producttypes.code LIKE '%ASO%' ORDER BY producttypes.SortOrder </cfquery> as a side note, the example you have <cfif GetProductTypes.Code CONTAINS "ASO"> <cfoutput query="GetProductTypes"> #Code#<br> </cfoutput> <cfelse> error message </cfif> is not working because the CFIF is outside the cfoutput. that means it's looking at the value in the first row returned, not each value. if you must do it that way for some reason, move the CFIF inside the OUTPUTs. christopher olive, cto, vp of web development cresco technologies, inc 410.931.4092 http://www.crescotech.com -----Original Message----- From: Michael Wilson [mailto:[EMAIL PROTECTED]] Sent: Monday, January 28, 2002 5:22 PM To: CF-Talk Subject: Filtering Query Results Hi all, I have a query, GetProductTypes: <cfquery name="GetProductTypes" datasource="#request.dsn#" dbtype="ODBC" username="#username#" password="#password#"> SELECT DISTINCT producttypes.Code, producttypes.ID, producttypes.SortOrder, products.ProductCategoryID, products.ProductTypeID, products.OrderOnlineStatus FROM producttypes, products WHERE products.ProductCategoryID = 28 AND producttypes.ID = products.ProductTypeID AND products.OrderOnlineStatus = 1 ORDER BY producttypes.SortOrder </cfquery> that returns a list of product types within category 28; say ASO (black) ASO (white) ASO Speed Lacer Air-Gel The products returned from the query are correct. I need to look at this list of returned products and display only those that have "ASO" in the "Code" field. I don't want to display the Air-Gel. Is there a way to filter the query results before displaying them? I tried this: <cfif GetProductTypes.Code CONTAINS "ASO"> <cfoutput query="GetProductTypes"> #Code#<br> </cfoutput> <cfelse> error message </cfif> .but it always returns false, even when GetProductTypes.Code contains ASO. I bet I am missing something really simple. :( Any help would be greatly appreciated. I am using CF 4.5 on a Win NT box. Thank you, Mike Michael Wilson - 961 Media, Inc======================= [EMAIL PROTECTED] http://www.961media.com <http://www.961media.com/> ======================= Phone 704.736.9009 Mobile 704.281.7616======================= Don't let anyone ever make you feel like you don't deserve what you want. ______________________________________________________________________ Why Share? Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation � $99/Month � Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

