我正在尝试执行此查询:
DELETE from TABLE1A
WHERE X IN
(SELECT A.X FROM
(SELECT X, r1.Y, r2.Y, DENSE_RANK() OVER (PARTITION by r1.Y, r2.Y ORDER by X) as RANK
FROM TABLE1B r0
INNER JOIN TABLE1A r1 on r0.X = r1.X
INNER JOIN TABLE1A r2 on r0.X = r2.X
WHERE r1.Y = foo and r2.Y = bar
) AS A WHERE A.RANK > 1
);
执行后,出现错误:SQL错误[268] [HY000]:SAP DBTech JDBC:[268](在63):列含糊不清:X
该查询可能出什么问题了?
答案 0 :(得分:1)
表R1和R2似乎都有名为X
的列,但是在窗口函数的ORDER BY
部分中,您没有指定应使用这些列中的哪一个;错误消息。