Reputation: 7059
I have a Mysql query. I want to filter only integer result. My query is-
SELECT * FROM table as p WHERE p.test between 0 AND 999
But result comes this-
747
748
749
FO4001
FO4002
750
751
I want to ask two things-
1)Is there any way to exclude below result-
FO4001
FO4002
2)Why are these coming in the result?
Upvotes: 2
Views: 1627
Reputation: 263733
Try this one, use REGEXP
to test if the value is all numeric.
SELECT *
FROM table1
WHERE x BETWEEN 0 AND 999
AND x REGEXP '^[0-9]+$';
Upvotes: 5