Dremio SQL - Clause DELETE following a clause WITH

Hi community,

In the dremio SQL editor, I am trying to use a simple DELETE clause after a WITH clause (see below).

Problem is that the DELETE clause looks like it is not supported after such a WITH clause : I get the warning “Extraneous token DELETE”.
Note that a clause SELECT after this clause WITH works perfectly.

Any idea ?

WITH tmpTable AS
(SELECT …
FROM mainTable
)

DELETE
FROM mainTable
WHERE mainTable.col1 IN (SELECT * FROM tmpTable)

Im trying to picture what this example would look like, can you share it?

Generally speaking, if you do it in two stages
CREATE TABLE tmpTable as SELECT...
then
DELETE...

does that work ok?