$dynamic with multiple groupBy statements

Is there a way to do this?
It seems that using more than one is overwriting the previous one.
Example:
function withAGroupBy<T extends PgSelect>(query: T) {
  return query
    .leftJoin(...)
    .groupBy(something1.id);
}
function withASecondGroupBy<T extends PgSelect>(query: T) {
  return query
    .leftJoin(...)
    .groupBy(something2.id);
}

query = something.$dynamic;
withAGroupBy(query);
withASecondGroupBy(query);
Was this page helpful?