Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 965583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:01:18+00:00 2026-05-16T02:01:18+00:00

Can I use expressions in Sql Server Reporting services to combine all of the

  • 0

Can I use expressions in Sql Server Reporting services to combine all of the values of a column within a group? I’m trying to accomplish what MySQL’s group_concat function does, but in the report (not in the query).

Example. I want to make this data:

Group 1  Value
Test
         A
         B
Test 2
         C
         D

Look this this in the report:

Group 1 Value
test    A, B
test 2  C, D
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:01:19+00:00Added an answer on May 16, 2026 at 2:01 am

    try something like this (works on SQL Server 2005 and up):

    set nocount on;
    declare @t table (id int, name varchar(20), x char(1))
    insert into @t (id, name, x)
    select 1,'test1', 'a' union
    select 1,'test1', 'b' union
    select 1,'test1', 'c' union
    select 2,'test2', 'a' union
    select 2,'test2', 'c' union
    select 3,'test3', 'b' union
    select 3,'test3', 'c' 
    SET NOCOUNT OFF
    
    SELECT p1.id, p1.name,
              stuff(
                       (SELECT
                            ', ' + x
                            FROM @t p2
                            WHERE p2.id=p1.id
                            ORDER BY name, x
                            FOR XML PATH('') 
                       )
                       ,1,2, ''
                   ) AS p3
          FROM @t p1
         GROUP BY 
            id, name
    

    OUTPUT:

    id          name                 p3
    ----------- -------------------- ---------
    1           test1                a, b, c
    2           test2                a, c
    3           test3                b, c
    
    (3 row(s) affected)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within SQL Server 2005 Reporting Services I am attempting to evaluate an expression which
I'm trying to make use of the custom code feature within SSRS (SQL Server
Using Reporting Services in SQL Server 2005: Is there a way to count only
Using SQL Server 2005 Full Text Search I'd like to return values within a
In some of our SQL Server Reporting Services reports we wrote for SQL 2005,
In the Expression builder window in SQL Server Reporting Services 2008 R2 under Common
Can you use a lambda expressions as an argument to an attribute? The motivation
I am trying to create Linq Expression that I can use to query child
I'm trying to find a single regular expression that I can use to parse
How can I use a calculated column multiple times in the same select without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.