in this statement
from
#base U
group by grouping sets
(
(a,b,c,d) --1
,(a,b,c,d,e,f) --2
,(a,b,c,d,e,f,g) --3
)
is possibile in a single set an filter before aggregation ?
(a,b,c,d,e,f) where b <> 0
in this statement
from
#base U
group by grouping sets
(
(a,b,c,d) --1
,(a,b,c,d,e,f) --2
,(a,b,c,d,e,f,g) --3
)
is possibile in a single set an filter before aggregation ?
(a,b,c,d,e,f) where b <> 0
An approach could be to put the (a,b,c,d,e,f) grouping with a filter as as a seperate query and then use UNION to merge the results.
Maybe you can try it .
select ...
from #base U
group by grouping sets
((a,b,c,d), (a,b,c,d,e,f,g))
union all
select ...
from #base U
where b<>0
group by a,b,c,d,e,f
Hope it can help you.
Best Regards,
Rachel