v.1.1.54337New Feature
Added WITH Clause Support for INSERT SELECT Query
Added support forWITHclauses for anINSERT SELECTquery (author: zhang2014).
Why it matters
This feature was created to enable the usage of WITH clauses in INSERT SELECT queries, which allows users to write more readable and maintainable queries by defining intermediate named result sets (CTEs). It solves the problem of having to repeat complex subqueries or calculations within the INSERT SELECT, improving query clarity and potentially performance by reusing CTEs.How to use it
You can use the WITH clause to define one or more common table expressions before your INSERT SELECT query. The CTEs can then be referenced in the SELECT part of the INSERT statement. For example:INSERT INTO target_table
WITH cte_name AS (
SELECT ... FROM source_table WHERE ...
)
SELECT * FROM cte_name WHERE ...