Suppose I have a really long query:
select T.TipoVers As TypeVers,
sum(T.ImpTot) As N,
C.DataCalendario As Date,
from ( SELECT ... )
group by C.DataCalendario, T.TipoVers
This produce output like:
TypeVers N Date
================================
Type1 1 2012-09-10
Type2 47 2012-09-10
Type3 5 2012-09-11
I almost done but the final touch will be: Rows with the same date
needs to be concatenate (for string value) and summed (for numeric value - right now this is the only part working), i.e.:
TypeVers N Date
====================================
Type1,Type2 48 2012-09-10
Type3 5 2012-09-11
I have read round here about XML path. The problem with that solution is great amount of code (I should rewrite my query inside the STUFF clause generating really long query). What alternatives I have?