PSQL: CASE/WHEN 无法将货币类型转换为整数
PSQL: CASE/WHEN could not convert type money to integer
这是查询的一部分:
(end_date - load_date)*tester_money/(load_date - start_date)
错误:
ERROR: CASE/WHEN could not convert type money to integer LINE 115:
WHEN load_date - start_date > 28 THEN tester_money...
如何进行这项工作?
tester_money
是money
类型,而日期是date
类型。
将金钱视为与区域设置相关的文本字符串。您必须将其转换回数字才能进行计算。 tester_money::numeric
查看以下内容linkhttp://www.postgresql.org/docs/current/static/datatype-money.html
这是查询的一部分:
(end_date - load_date)*tester_money/(load_date - start_date)
错误:
ERROR: CASE/WHEN could not convert type money to integer LINE 115:
WHEN load_date - start_date > 28 THEN tester_money...
如何进行这项工作?
tester_money
是money
类型,而日期是date
类型。
将金钱视为与区域设置相关的文本字符串。您必须将其转换回数字才能进行计算。 tester_money::numeric
查看以下内容linkhttp://www.postgresql.org/docs/current/static/datatype-money.html