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 693991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:48:39+00:00 2026-05-14T02:48:39+00:00

A co-worker posed this question to me, and I told them, No, you’ll need

  • 0

A co-worker posed this question to me, and I told them, “No, you’ll need to write a sproc for that”. But I thought I’d give them a chance and put this out to the community.

Essentially, they have a table with keys mapping to multiple values. For a report, they want to aggregate on the key and “mash” all of the values into a single field. Here’s a visual:

---  -------
Key  Value
---  -------
1    A
1    B
1    C
2    X
2    Y

The result would be as follows:

---  -------
Key  Value
---  -------
1    A,B,C
2    X,Y

They need this in SQLServer 2005. Again, I think they need to write a stored procedure, but if anyone knows a magic out-of-the-box function that does this, I’d be impressed.

  • 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-14T02:48:40+00:00Added an answer on May 14, 2026 at 2:48 am

    I’m not sure if sql-server supports group_concat – but that’s what you would use in MySQL:

    SELECT key, GROUP_CONCAT(value) FROM table_name GROUP BY key
    

    I use this all the time.

    Also to add to this GROUP_CONCAT by default will separate value using commas, but you can format it any way you want – interjecting text, calculations or values from other columns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is related to another question that I posted on SO earlier How
first I know this question has been posted alot of times on internet, but
(This question is similar to the one I recently posted here except that now
Co-worker is sure he checked in a file: foo_oustanding.dpr but isn't sure when/where (we
I have a background worker thread that is constantly syncing data to/from a remote
I posted this over at reddit but it didn't gain any momentum. So here
This is sort of the next step of the LINQ to DB2 question I
I know this question is a duplicate of Execute method on startup in spring
UPDATE The second after I posted this question, thanks to the syntax highlighting of
Last Updated: 2009-08-11 2:30pm EDT A few days ago I posted this question about

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.