Raj, That is the same as writing this:
SELECT * from prds WHERE 1=1 and prds.title like 'test,test1' Unless prds.title is exactly 'test,test1' you will not get any records returned. Like requires the use of wildcards to be valuable. You'd want your query to look like: SELECT * from prds WHERE 1=1 AND (prds.title like '%test%' OR prds.title like '%test1%') So you'd need to loop through your list of keywords, and construct your query appropriately. Also note the use of parenthesis. This is important when you are using ANDs and ORs together. Cheers, Kris > what's wrong with this code.... > > <cfset keyword = "test,test1"> > > <cfquery name='getdata' datasource='abcde'> > SELECT * from prds > WHERE 1 = 1 > and prds.title like <cfqueryparam cfsqltype="cf_sql_varchar" > list="true" value="#keyword#"> > </cfquery> > > I am trying to get data from database with those two key words, if any title > has the keyword test or test1 pull that data, i don't know what i am > missing... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285067 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

