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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:22:17+00:00 2026-05-28T13:22:17+00:00

I have a table of information in a SQL Server database and another table

  • 0

I have a table of information in a SQL Server database and another table of group info which I’d like to concatenate into the first table.

e.g.

table1:

1 | 'foo' | 'bar,baz'

and

table2:

1 | 'bar'
1 | 'baz'

I want to replace the need for that third column in table1 by doing a GROUP BY CONCAT with table2. The only issue is after I am done developing this project I’m conscious I will need to port the SQL to Oracle, so perhaps doing a separate SELECT for one column of the gridview is a better alternative?

Thanks a lot.

  • 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-28T13:22:18+00:00Added an answer on May 28, 2026 at 1:22 pm

    Easy MS SQL concat can be done with converting rows you need to XML and back to nvarchar. Example:
    Imagine you have 2 tables – one for Contacts (with PK ID) and second with ContactTypes (with ContactID as FK, could have multiple rows for 1 contact). You need to concat all types to 1 row. Here is trick to do this:

    SELECT c.ContactID, CONVERT(VARCHAR(MAX), /* concatenate all Types to varchar */
    (
                      SELECT ct.ContactTypeDescription+ ', '
                      FROM   ContactTypes ct
                      JOIN Contacts c1 ON  ct.ContactID = c1.ContactID 
                       FOR XML PATH('')
                )) AS ContactTypes, * 
                FROM Contacts c
    

    This should make output like this:

    1 | Type1, Type2,  ... | ...
    2 | Type3, Type10, ... | ...
    

    etc.

    Dunno about Oracle port, hope this helps…

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

Sidebar

Related Questions

Greetings friends, In my MySQL database, I have 'MAB' table which contains information about
I have a Products table in SQL Server database, it has an ID column
In a SQL Server 2005 database I have a table with data logged when
I have a table in a SQL Server 2005 Database that is used a
we have a table with +- 500k rows in Sql Server 2005 database and
Say I have at database table containing information about a news article in each
I have a table in MySQL of contact information ; first name , last
I have a table (user) that contains user information. I have another table (userview)
I would like to generate a Data Dictionary for a SQL Server 2008 database
I have a database running under Sql server 2005 with merge replication. I want

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.