CAP 框架 CQL UPDATE 与时间戳比较或 case-when 语句

问题描述 投票:0回答:0

我正在尝试使用包含两个时间戳比较的 where 条件更新实体集。但是,这是行不通的,因为无法以某种方式比较时间戳(无论我对时间戳应用哪种操作,我都没有得到任何命中)。

UPDATE(CardReceiverAllocation).set({ isCurrentAllocation: true }).where({ card_ID: receiverEntryResult.card_ID, receiver_ID: receiverEntryResult.receiver_ID, timestamp: maxTimestamp })

作为替代方案,我尝试使用包含性 CASE WHEN 语句编写 UPDATE 语句,但这会生成错误“列是布尔类型,但表达式是文本类型”,即使我在语句中返回布尔值。

UPDATE`efa_CardReceiverAllocation`.set`isCurrentAllocation = ( case when timestamp = (    select max(timestamp) as maxTimestamp from efa.CardReceiverAllocation as CRA where CRA.receiver_ID = receiver_ID and CRA.card_ID = card_ID ) then true else false end )`

我怎样才能实现这个更新?

javascript node.js cql cap
© www.soinside.com 2019 - 2024. All rights reserved.