Open cedx opened 10 months ago
In this kind of query:
import tink.sql.expr.Functions; return db.picture .leftJoin(db.vote).on(vote.pictureId == picture.id) .select({createdAt: picture.createdAt, id: picture.id, voteCount: Functions.count(vote.id)}) .groupBy(row -> [row.picture.id]) .orderBy(row -> [{field: row.voteCount, order: Desc}]) // Error: <type> has no field voteCount. .all(); .next(rows -> trace(rows.map(row -> row.voteCount)); // OK.
In the next() call, I can access the aggregated value (i.e. voteCount), but I can't use it in the orderBy() clause.
next()
voteCount
orderBy()
In this kind of query:
In the
next()
call, I can access the aggregated value (i.e.voteCount
), but I can't use it in theorderBy()
clause.