Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有那个表:exitAndEnter 和列 id,exitHour
我想做这样的事情:
update exitAndEnter set exitHour=? where id=? AND (exitHour=LAST(exitHour) from enterAndExit)
我希望仅当它是请求的 id 中的最后一条记录时才更新 exitHour
我希望我正确地解释了我自己
我假设“id”字段是自动递增的,如果 id 是 max() 或最后一条记录,“exitHour”将被更新
update exitAndEnter set exitHour=? where exitHour in(select max(exitHour) from exitAndEnter where id=?)