query matching a column to a search string

Discussion in 'MySQL' started by waynehw23, Apr 5, 2010.

  1. #1
    i am attempting to select all the rows where a columns value is the substring of (contained within) a search string ...

    table:
    id | value
    1 domain.com
    2 domain.com/test
    3 domain.com/test/subfolder
    4 domain.com/test/subfolder/sub2

    so if the search string == "^domain.com/test/sub" - the first 3 rows should be returned. using 'LIKE' or 'RLIKE' only matches the rows where the search string is a substring of the column value (ie. returning the last 2 rows).

    is it possible to do this within a single query? do i need a more complex setup? if so, what and how?

    thanks in advance for any and all help.
     
    waynehw23, Apr 5, 2010 IP