withAvgExact<TChild> method
MssqlProjectedQuery<(TRow, MssqlDecimal?)>
withAvgExact<TChild>(
- MssqlRelation<
TRow, TChild> relation(- TFields fields
- MssqlExpression operand, {
- int exactScale = 6,
Parent rows plus an exact AVG of operand on matching children.
AVG of an integer column is integer division in SQL Server, so this
method casts to decimal(38, exactScale) first and hands back an
MssqlDecimal. Which method you call is what answers the
integer-division question — a flag whose result type the caller cannot
see would not.
Implementation
MssqlProjectedQuery<(TRow, MssqlDecimal?)> withAvgExact<TChild>(
MssqlRelation<TRow, TChild> Function(TFields fields) relation,
MssqlExpression operand, {
int exactScale = 6,
}) {
return _withAggregate(
relation,
MssqlAggregate.avg(
operand,
integers: MssqlIntegerAverage.exactDecimal,
exactScale: exactScale,
),
(v) => _decodeAggregate<MssqlDecimal>('withAvgExact', v),
);
}