Subquery

Read first: Introduction to sub query in SQL

Also read: Documentation on subquery in SeaORM

As it is not mentioned explicitly in the documentation, one might think that SeaORM only supports subquery for WHERE..IN.. as in the documentation. However, looking at the documentation of SeaQuery, and search for subquery, one shall be presented with that SeaQuery supports subquery just like any other expressions.

A Select/Insert/Update/Delete/With Statement can be converted to a SubQueryStatement, then into SimpleExpr, with the variant SimpleExpr::SubQuery(Option<SubQueryOper>, Box<SubQueryStatement>).

The application is trivial and has been left as an exercise for the reader.