Yes, there is a reason. Your version would retrieve any value that contained a 5 without respect to the list delimiters. Since, with SQL, there's no good way to parse/evaluate a list this is the only option that will properly limit the results.
I don't think anyone would argue that it's inefficient and generally something to be avoided (vigorously), but sometimes you just have to handle what you've got. Ben's code is the only way I can think of to handle what Patrick's got. On 4/5/06, Ian Skinner <[EMAIL PROTECTED]> wrote: > SELECT > [column list] > FROM > [table] > WHERE > catid LIKE '#ID#' > OR > catid LIKE '#ID#,%' > OR > catid LIKE '%,#ID#' > OR > catid LIKE '%,#ID#,%' > > > Couldn't that WHERE clause be consolidated into one line such as: > > WHERE > catid LIKE '%#ID#%' > > Or is there some performance benefit of using the four variations? Since > using the LIKE clause can be a performance killer. > > -------------- > Ian Skinner > Web Programmer > BloodSource > www.BloodSource.org > Sacramento, CA > > --------- > | 1 | | > --------- Binary Soduko > | | | > --------- > > "C code. C code run. Run code run. Please!" > - Cynthia Dunning > > Confidentiality Notice: This message including any > attachments is for the sole use of the intended > recipient(s) and may contain confidential and privileged > information. Any unauthorized review, use, disclosure or > distribution is prohibited. If you are not the > intended recipient, please contact the sender and > delete any copies of this message. > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237030 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54