Reputation: 13
I would like convert a string parameter in a integer inside a where condition.
Case:
SELECT * FROM `pro` WHERE `fld_custom_1` <= '85';
I would like convert the '85'(STRING)
in 85(INTEGER)
.
It's possible?
Upvotes: 1
Views: 7819
Reputation: 204756
SELECT * FROM pro WHERE fld_custom_1 <= cast(@param as unsigned)
When fld_custom_1
is of a number data type then MySQL will automatically convert the string parameter to a number to make the comparision.
Upvotes: 1