With

July 26, 2025 ยท View on GitHub

< Index

With

The with clause provides CTEs to select statements. The CTEs can then be used as read-only tables in the statement, e.g. they can be provided in the from clause of a select statement and their columns can be selected or used in a where clause.

const auto x = sqlpp::cte(sqlpp::alias::x).as(select(foo.id).from(foo));

for (const auto& row : db(with(x) << select(x.id).from(x).where(x.id < 17))) {
  // ...
}

< Index