On 6/13/07, Gaulin, Mark <[EMAIL PROTECTED]> wrote: > This seems like a really complicated way of saying "AND ((ProductGroupID > = @productgroupid) OR (@productgroupid = 0))". Am I missing something? >
I think "really" complicated is a bit harsh...perhaps "more" complicated...and the previous version doesn't care what the value of @productgroupid is, unless it is greater than 0...it could be 0 or -1 or NULL and return all records...in your example it must be 0 to return all records....which may be fine depending on what you are expecting as inputs. The following should work the same as my previous statement.... AND ((@productgroupid <= 0) OR (@productgroupid IS NULL) OR (ProductGroupID = @productgroupid)) And all of these examples, while fun exercises, ignore the fact that the conditional processing still may not be faster in SQL, as Jochem pointed out. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & Flex 2 Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280991 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4