I need to remove all but integers from a column and I need to do this entirely in a mysql query. This should be easy...right?

It is for a billnumber lookup - so searching for '1' will find 'HR 1', 'HR1', but not 'HR11'. I don't have time to fix the database design for a better implementation.

    To answer my own question, it can be done through nested replace functions - ugly, but workable.

      Sounds like REGEX would do it.

        Yes! Thanks tomhath!

        WHERE billnumber REGEXP "[0-9]*1$"

          Write a Reply...