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_moneymoney类型,而日期是date类型。

将金钱视​​为与区域设置相关的文本字符串。您必须将其转换回数字才能进行计算。 tester_money::numeric

查看以下内容linkhttp://www.postgresql.org/docs/current/static/datatype-money.html