Module is.codion.framework.domain
Interface EntitySelectQuery.Builder.WithAsStep
- Enclosing interface:
EntitySelectQuery.Builder
public static sealed interface EntitySelectQuery.Builder.WithAsStep
Adds a common table expression (CTE) to the query.
CTEs are prepended to the query using the WITH clause.
Generates:
Example:
EntitySelectQuery.builder()
.with("track_revenue")
.as("SELECT track_id, SUM(unitprice * quantity) AS revenue FROM chinook.invoiceline GROUP BY track_id")
.from("track_revenue")
.columns("track_id, revenue")
.build();
WITH track_revenue AS (SELECT track_id, SUM(unitprice * quantity) AS revenue FROM chinook.invoiceline GROUP BY track_id)
SELECT track_id, revenue
FROM track_revenue
-
Method Summary
-
Method Details
-
as
- Parameters:
query- the CTE query, without the WITH keyword- Returns:
- this Builder instance
- Throws:
IllegalArgumentException- if query contains the WITH keyword
-