Back to questions
JuniorTheoryCommon
How many rows does the query return?
// Продажи: ручка 100, клей 40, клей 30, ластик 50, ластик 20
ВЫБРАТЬ
Продажи.Товар КАК Товар,
СУММА(Продажи.Сумма) КАК Сумма
ИЗ Документ.Продажа.Товары КАК Продажи
ГДЕ
Продажи.Сумма > 25
СГРУППИРОВАТЬ ПО
Продажи.Товар
ИМЕЮЩИЕ
СУММА(Продажи.Сумма) > 602
- Expecting
ГДЕto filter the grouped sums: it checks the source rows before grouping - Checking each row on its own in
ИМЕЮЩИЕ: its condition is computed on the sum of the group
- How many rows does the query return without the
ГДЕclause? - Why is a condition on a field without an aggregate better placed in
ГДЕthan inИМЕЮЩИЕ?