我已经得到了它并且它无法正常工作(SQL语法错误):
SELECT database_percent, national_percent, (database_percent/national_percent) AS calculated_index INT(3) FROM full_data_complete
如果我取出INT(3)
部分,它运行正常。
我希望创建一个以INT(3)
作为格式的选择。我需要做些什么?
答案 0 :(得分:0)
据我了解,您可以使用以下方法之一:
SELECT database_percent, national_percent, format(database_percent/national_percent, 0) AS calculated_index FROM full_data_complete
或
SELECT database_percent, national_percent, cast(database_percent/national_percent as signed) AS calculated_index FROM full_data_complete
或
SELECT database_percent, national_percent, round(database_percent/national_percent, 0) AS calculated_index FROM full_data_complete
我希望这会有所帮助。