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

  • Home
  • SEARCH
  • 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 6943923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:13:09+00:00 2026-05-27T13:13:09+00:00

Here is my table: CODE __NAME 1000 ___AB 1001 ___CA 1001 ___DR 1001 ___LVN

  • 0

Here is my table:

 CODE     __NAME
 1000     ___AB
 1001     ___CA
 1001     ___DR
 1001     ___LVN
 1100     ___ER
 1110     ___WL

What I want to get to is:

 CODE___NAME
 1000  ___AB
 1001  ___CA,DR,LVN
 1100  ___ER
 1110  ___WL

I know I can use looping to accomplish this but I was wondering if there might be a better way. Thanks

  • 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-27T13:13:09+00:00Added an answer on May 27, 2026 at 1:13 pm

    Try something like this, this will get you what you want.

       Select 
            Main.CODE,
            Left(Main.Names,Len(Main.Names)-1) As Names
        From
            (
            Select distinct T2.CODE, 
            (
             Select 
                RTRIM(T1.NAME) + ', ' AS [text()]
             From   
                Test T1
             Where
                T1.CODE = T2.CODE
             ORDER BY 
                T1.CODE
             For XML PATH ('')
            ) [Names]
            From Test T2
            ) [Main]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Replaces Question: Update multiple rows into SQL table Here's a Code Snippet to update
Here is jquery code which hides my table cells with the ID of .style2:
Here is my code that fails: bool Table::win(const Card &card) { for (int i
Here is the LaTeX code for my table: \begin{table}{| c || c | c
enter code here I have a table on SQL server 2005 with bigint primary
Here's the .jsp code: <table> <s:iterator value=allAgents> <tr> <td><s:property value=firstName /></td> <td><s:property value=middleName /></td>
Here is my actual table schema (I'm using Mysql) : Table experiment : code(int)
i want to save xml data into a table in sp,passed as string,here is
I have a mysql table with contents the structure is here: I want to
here is my plugin activation code $classified_category_name = 'classified'; $credit_table_name = 'credits'; $credit_table_version =

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.