Would another good way to do this be to group all the ANDs (assuming that they have content to use in the query) together in parens and then have all the ORs following?
1=1 AND (UPPER(n.meeting_name) LIKE '%somevalue%' AND UPPER(n.type) LIKE '%anothervalue%') OR UPPER(n.notes) LIKE '%thirdvalue%' OR UPPER(n.notes_type) LIKE '%fourthvalue%' >In that previous message, I meant to say... > >1. If url.meeting_name IS "" AND url.type IS NOT "" AND url.and_or_1 IS >"OR", then you are >going to return all records, no matter what you have in url.type. >Does >1=1 AND UPPER(n.meeting_name) LIKE '%somevalue%' AND UPPER(n.type) LIKE >'%anothervalue%' OR UPPER(n.notes) LIKE '%thirdvalue%' > >Actually mean... >(1=1 AND UPPER(n.meeting_name) LIKE '%somevalue%' AND UPPER(n.type) LIKE >'%anothervalue%') OR UPPER(n.notes) LIKE '%thirdvalue%' > >or does it mean... > >1=1 AND UPPER(n.meeting_name) LIKE '%somevalue%' AND (UPPER(n.type) LIKE >'%anothervalue%' OR UPPER(n.notes) LIKE '%thirdvalue%') > >I'm not sure about Oracle's precedence (I believe that is what you are >using), but I'm betting that it will return like the one with all the >ANDs grouped. > >I think it is a better to give the user the option of "Return records >that match any parameter" and "Only return records that match ALL >parameters", and then just use AND and OR consistently based on that. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:268003 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

