Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002

    Question Unanswered: Numeric string wildcards?

    Is it possible to search just numeric characters in a string using wildcards?


    I want to find Clients with Code of 60111, 61234, etc. The field is varchar but the sequence I want is always 5 numerics starting with '6' (6####). However, there are also codes such as 6123A or 6055G, which I do not want included in my results.

    When searching on
    "ClientCode like '6%'"
    "ClientCode like '6____'"

    I get the codes included I do not want.

    I know in Access I can search for just numeric values (ClientCode like '6####'). I've tried that in MySQL with no success so far. Is this possible?

  2. #2
    Join Date
    Jan 2004
    To be honest with you, I have never tried this. But right off the top of my head, what I would do is say left(field,5) > 60000, since if you get back, 6111A, it would be less than 60000.


  3. #3
    Join Date
    Nov 2003
    you could also use regular expressions,

    ... WHERE ClientCode REGEXP "^6[0-9]{4}"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts