Sql PIVOT and string concatenation aggregate

前端 未结 4 1774
梦谈多话
梦谈多话 2020-11-27 19:45

I would like to use a pivot SQL query to construct a result table where the concatenate text as a result within the DATA section of the pivot table.

i.e. i have the

4条回答
  •  半阙折子戏
    2020-11-27 20:09

    In report builder you should use the Table or Matrix wizard and do the following:

    • Resource Type field as the column groups.
    • Event Name field as the row groups.
    • And Resource Name field as details, you will have to use an aggregatre function such as Count.

    At this stage complete the wizard then once complete edit the Resource Name cell as an expression. Replace the expression with:

    =Join( LookupSet( Fields!EVENT_NAME.Value + Fields!RESOURCE_TYPE.Value,
                      Fields!EVENT_NAME.Value + Fields!RESOURCE_TYPE.Value,
                      Fields!RESOURCE_NAME.Value, "DataSet1"), ", ")
    

    Now tried and tested:

    enter image description here

提交回复
热议问题