I have a column, called value, that includes strings as well as numbers as data, eg:
- contentid, value
- 16, 200
- 18, 150
- 47, Foo
- 16, Red
- 16, 50
- 18, GREEN
I need a way to retrieve only the results that are actual numbers (and, additionally, that are <= 180).
The expected results from above should be: 18, 150 and 16, 50 but I am getting results with strings as well.
I have tried this from other SO questions:
SELECT * 
FROM  `contentvalues` 
WHERE (
contentid =16
OR contentid =18
)
AND `value` <= 180
AND value NOT LIKE  '%[a-z0-9]%'
But this has not worked.
Would anyone be able to point me in the right direction?
 
     
     
    