我试图在我的Entity Java Bean
类中编写一个命名查询,并尝试将相同的查询编写为本机查询,其工作是删除其时间戳列与当前时间戳之间差异的记录,超过2小时。
我的疑问:
DELETE FROM APP.WEATHER WHERE timestampdiff(SQL_TSI_HOUR,APP.WEATHER.SINCE,CURRENT_TIMESTAMP) > 2;
但它失败了,这个错误信息出现在我身上:
Error code -1, SQL state 42X04: Column 'SQL_TSI_HOUR' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'SQL_TSI_HOUR' is not a column in the target table.
Line 1, column 1