Here’s the query
SELECT * FROM TABLE WHERE id = ‘7883c2c8e6′ AND value > ’45’ DESC
But for some reason it is returning a row where the value for the field value is 8. I have checked and it has not preceding or following characters. The field is currently set as varchar. I was wondering if this could affect the outcome?
If I change the direction of the > to < this row does not show up, but it should be the other way round surely?
Because ‘8’ is greater than ’45’ (in alphabetical order).
Cast your values to int: