问题
I want to achieve this:
SELECT * FROM linkledger WHERE toInt(reputation) > 100;
but the function toInt doesnt exist? Is there one?
I found this now but not working, which implies i have a more fundemental problem. BECAUSE THIS IS CORRECT
SELECT * FROM linkledger WHERE cast(reputation AS INTEGER) > 100;
回答1:
Use CAST(reputation AS INTEGER).
回答2:
I will leave Anik Islam Abhi's answer as the correct one because it will apply in most cases but I just want it on record that I only managed to fix the problem by just switching the variable to int
create table foo reputation int;
And then insuring Ints were inserted... I'm not sure what was happening that the correct answer didnt solve my problem.
来源:https://stackoverflow.com/questions/26522727/convert-string-to-int-inside-where-clause-of-sqlite-statment