LIKE _ wildcard

Discussion in 'MySQL' started by Cobnut, Oct 26, 2007.

  1. #1
    Tearing my hair out over this...

    I need to use more than one _ wildcard character in my query (at least I think I do) and my local dev server is not behaving as expected. If I say:

    SELECT * FROM table WHERE item LIKE 'ab___'
    Code (markup):
    (that's three _) I expect it to return every value that's 5 characters long and begins 'ab'. Instead it only returns 3 character values. It's as though it's only reading the first '_' and ignoring the other two. Resources I've found on't web suggest that this should be possible but it doesn't seem to work for me.

    If I try a LIKE like 'a_c_e' it returns 0.

    Could this be a setting or some other setup issue in my local MySQL installation?

    Jon
     
    Cobnut, Oct 26, 2007 IP