SQL 包含 WITH 和 SELECT 的 INSERT 语句

SQL INSERT statement including a WITH and SELECT

我正在寻找 运行 在 SELECT 之前使用 WITH 子句将 INSERT 插入 table。我尝试将 WITH 放在 INSERT 之前和 SELECT 之前,但我 SQL 不喜欢这种格式。

这是一个例子

INSERT
INTO    values (a,b)  //more values
WITH   table AS
    (
    SELECT  *
    FROM    table1
    )
WITH    table2 AS   //from more tables
    (
    SELECT  *
    FROM    table_2
    )         
SELECT  t.value as a, t2.value as b
FROM    table t 
JOIN table2 t2 on t.value = t2.value //some join
WHERE t.value = 'X'   //other stuff