NexusDB 声明并设置 table 结果为一个变量并 select 它

NexusDB declare and set table result in a variable and select it

在 NexusDB 中,我尝试在变量中创建添加查询结果,然后更新 selected 项,然后 select 变量

START TRANSACTION;
    set result = (SELECT * FROM "some_table" where synced = false);
    UPDATE some_table set synced = true where synced = false;
    select result;
COMMIT;

NexusDB:Query78696906:查询执行失败: 语句错误:无法解析第 4 行的标识符 "result",位置 12

答案:

 SELECT * INTO #tmp from some_table where synced is null;
 UPDATE some_table set synced = true where synced is null;
 select * #tmp;

"select result" 是语法错误。 NexusDB 期望您 select 从某些东西;在这种情况下,您可以使用专门用于此目的的内置#dummy table。所以:

SELECT 结果来自 #dummy