tips for Query Builder
//how to use a subquery
$subquery = (new Query())
->select(...)
->from(...)
->where(...);
$query = (new Query())
->select(...)
->from(...)
->leftJoin(['subquery' => $subquery], 'subquery.query_id = query.id' )
...
/*where - operators
is null
is not null
is not equal to
any operator
*/
->where(['stato_id' => null]])
->where(['not', ['stato_id' => null]])
->where(['not', ['stato_id' => Constants::STATO_ATTIVO]])
->where(['>', 'netto', 120])