Is there a way to "select from select" in table_query?


I’m wondering if it’s possible by code to replicate the SQL syntax in table_query def:
“select from (select id as id from table t) tt”
and where I can find an example ?

Tks in advance,

See the “Select with sub-select” in the python-sql examples.
This is because the SelectQuery object is a subclass of FromItem object.

In fact I realise that what I need is more a “having” instruction to a group_by select for instance :
select sum(quantity) from table group_by product having sum(quantity) > 0
I don’t find the having instruction in python-sql but is it possible to put the select without the having condition in a table variable and select the element > 0 in this table ?

python-sql supports having clause on Select query.
The example in the README are not exhaustif but you can assume that all SQL standard features (especially the very common) are in python-sql.

Ok great I try it tks Cedric