MySQL Pattern Matching with LIKE

Discussion in 'MySQL' started by Cinta April, Apr 24, 2008.

  1. #1
    Hi I try selecting names from my database using LIKE and it works fine on names where there is no number. However when there is a number behind the name the pattern does not match. How do I match names with numbers and other characters using LIKE?

    for example
    name:john
    ... WHERE name LIKE '%john%'
    works well
    but
    name:john12
    ... WHERE name LIKE '%john%'
    does not work
     
    Cinta April, Apr 24, 2008 IP
  2. CreativeClans

    CreativeClans Peon

    Messages:
    128
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It should work. The problem must be another. Are you sure the name is 'john12' and not for example 'John12' ?
    Why don't you post your code, maybe we can find the problem.
     
    CreativeClans, Apr 28, 2008 IP