Les, if that variable is the result of another query, then you can accomplish what you want MUCH MUCH faster using an in clause. Can you post this whole section of code and we can optimize it for you. We need to see the query that is getting you the values for theme_id variable, plus any other code where you are manipulating info from that query.
When your tables get larger, the LIKE and OR solution we had is going to get very slow for you. The IN clause would be a bit faster for sure. Dave -----Original Message----- From: Les Irvin [mailto:[EMAIL PROTECTED] Sent: Saturday, January 27, 2007 1:17 PM To: CF-Talk Subject: Re: Querying a delimited text field Yes, Themes.id is actually a variable - a result of an earlier query. On 1/27/07, Dave Phillips <[EMAIL PROTECTED]> wrote: > > I think that his 'themes_id' is a coldfusion variable. Les, can you > please confirm this or not? It makes a big difference in how things > might work. > > Dave > > -----Original Message----- > From: Doug Brown [mailto:[EMAIL PROTECTED] > Sent: Saturday, January 27, 2007 12:46 PM > To: CF-Talk > Subject: Re: Querying a delimited text field > > > Ok, well maybe an IN statement. I may be way off base though. > > IE: > > <CFQUERY NAME="names" DATASOURCE="#DB_redwood#"> > SELECT distinct lname, fname, artist_id > FROM photos, photographers > WHERE photos.theme_id IN (SELECT themes.id FROM photos) > and photographers.id = photos.artist_id > order by lname > </CFQUERY> > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267853 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

