Menu

document Function - InlineAggrOrderBy

ema manu

InlineAggrOrderBy

Like InlineAggr, this function aggregates values and gets them in order by a column.

example:

select c1,
       config.[InlineAggr](c3,';',0,0),
       config.[InlineAggrOrderBy](c3,';',c0,0,0)
from
(
    select 'a'c0,'a1'c1,'b1'c2,'c1'c3 union all
    select 'a'c0,'a1'c1,'bfd1'c2,'cwe1'c3 union all
    select 'z'c0,'a1'c1,'bas1'c2,'cfffff1'c3 union all
    select 'z'c0,'a1'c1,'bas1'c2,'cfffff1'c3 union all
    select 'd'c0,'a2'c1,'b2'c2,'c2'c3 union all
    select 'f'c0,'a3'c1,'b3'c2,'c3'c3 union all
    select 'a'c0,'a4'c1,'b4'c2,'c4'c3 union all
    select 'a'c0,'a5'c1,'b5'c2,'c5'c3 union all
    select 'a'c0,'a6'c1,'b6'c2,'c6'c3
)t
group by c1

parameters:

@value:
it's the column to concatenate

@del:
it's the delimitator of values

@orderby:
the column use to order values

@desc:
0 for asc, 1 for desc

@numeric
0 if the column is to manage like string, 1 to use like numbers
(for example, string '02' is before '1'. parsed in numbers '1' is before '02' )