我正在尝试将其获取为:
SELECT * FROM "Employee" WHERE TIMESTAMPDIFF('YEAR', "BirthDate", "HireDate");
但出现下一个错误:
ERROR: function timestampdiff(unknown, timestamp without time zone, timestamp without time zone) does not exist
LINE 1: SELECT * FROM "Employee" WHERE TIMESTAMPDIFF('YEAR', "BirthD...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
我发现了另一种获取两个日期之间差异的方法,但是在我的说明中,它说我必须通过TIMESTAMPDIFF
来获取。
有人可以帮助我在哪里查看以及如何纠正我的错误吗?
答案 0 :(得分:2)
您可以使用减号运算符
EXTRACT(DAY FROM (HireDate)-(BirthDate)) AS DateDifference
示例select date '2001-10-01' - date '2001-09-28'