const sq = this.db.$with('prods_with_qty').as(
this.db
.select({
...getTableColumns(ProductsTable),
qty: SQL_PRODUCT_STOCKS_QTY,
})
.from(ProductsTable),
);
this.db
.with(sq)
.select({
...sq._.selectedFields, // <- here. It's working perfectly fine, but should I do that?
owner: SQL_USER_MINI_RES_COLS,
})
.from(sq)
const sq = this.db.$with('prods_with_qty').as(
this.db
.select({
...getTableColumns(ProductsTable),
qty: SQL_PRODUCT_STOCKS_QTY,
})
.from(ProductsTable),
);
this.db
.with(sq)
.select({
...sq._.selectedFields, // <- here. It's working perfectly fine, but should I do that?
owner: SQL_USER_MINI_RES_COLS,
})
.from(sq)