This may be specific to SAP HANA, but how come this does not work and is there a recommended workaround:
DELETE FROM
(SELECT
PKID
, a
, b)
Where a > 1
There is a Syntax Error at "("
In fact, DELETE FROM (TABLE) where a > 1
does not work either and gives the same syntax error.
The problem is that I need to delete specific rows that are flagged used a Rank function in my select statement.
Thanks (first post, been lurking and searching forever).
-CW
Thanks for the responses. I have now put a table immediately after the DELETE FROM and put Where restrictions on the DELETE and in a small series of self-joins of the table.
DELETE from TABLE1
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 TABLE2 r0
INNER JOIN TABLE1 r1 on r0.x = r1.x
INNER JOIN TABLE1 r2 on r0.x = r2.x
WHERE r1.y = foo and r2.y = bar
) as A WHERE A.RANK > 1
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.