Answer the question
In order to leave comments, you need to log in
Aggregation in group and window function context?
How will this request work?
will the inner sum calculate the sum within buy groups if ins_date is equal to cur_date, and then the outer sum will sum up the result in the context of sections?
select cur_date,
field_1,
field_2,
field_3,
field_4,
sum(sum(case when ins_date = cur_date then val else 0 end))
over(partition by
field_2,
field_3,
field_4 ) -- group by within company if field_1 -company
from table_1
where ins_date between add_months(cur_date, -2) and cur_date
group by
field_1,
field_2,
field_3,
field_4,
Answer the question
In order to leave comments, you need to log in
How will this request work?
will the inner sum calculate the sum within buy groups if ins_date is equal to cur_date, and then the outer sum sums the result in the context of sections?
30%
- keywords 30% - words "here", "here", etc.
30% - just links: " site.ru/statya.html "
Buy eternal, very smoothly, slowly, only on thematic sites with traffic from 400 PS :
Personal opinion
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question