severndigital Posted March 2, 2013 Share Posted March 2, 2013 I know most of this issue is me not knowing how to use SIMILAR TO and regex so any help would be great. I am trying to match a product title entered into a search field with titles already in a database. for example in the database the title is "Robocop" when I look up another title say ... "Robocop Blu-Ray" or "Robocop (The Criterion Collection)" or "Prime Directives Robocop Series" how can I get it to return a match? Thanks in advance. C Quote Link to comment Share on other sites More sharing options...
vinny42 Posted August 12, 2013 Share Posted August 12, 2013 Sounds like you can get away with a simple LIKE statement: WHERE title LIKE '%' || your_string_here || '%' The % signs are wildcards and the || signs append the who thing together to become '%Robocop%' Note however that LIKE statements that start with a wildcard can be very slow because the database cannot use indexes to eliminate records that cannot possibly match. FULLTEXT may be a better solution, but is (a little) more complex to setup Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.