mysql - select rows has numeric length more than x -
i have these values in database under field name : username , table name : users
... | username | ... -------------------------- | a651378 | | b3789 | | c3125621903 | | d32168 | | e789532 | | f41589964312 | for example how select username has number length greater 6 digits
as above values query should return
... | username | ... -------------------------- | c3125621903 | | f41589964312 |
assuming not know how long character portions are, can use regular expressions:
select u.* users u u.username regexp '^.*[0-9]{7}.*$'; actually, can simplified to:
select u.* users u u.username regexp '[0-9]{7}'; when using regular expressions, careful. like patterns match whole string (from beginning end). regexp patterns match within string.
Comments
Post a Comment