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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:29:29+00:00 2026-06-01T14:29:29+00:00

Problem: I’d like to combine the results of a subquery as a text field,

  • 0

Problem: I’d like to combine the results of a subquery as a text field, with the results separated by a comma (or any symbol really), into the results of the main query.

Example:

Table 1:

 +----------+---------+
 |  user_ID | user    |
 +----------+---------+
 |        1 |   Smith |
 +----------+---------+
 |        2 |   Jones |
 +----------+---------+

Table 1:

 +----------+---------+
 |  user_ID | roles   |
 +----------+---------+
 |        1 |   Admin |
 +----------+---------+
 |        2 |   Staff |
 +----------+---------+
 |        2 |   Admin |
 +----------+---------+
 |        2 |   Super |
 +----------+---------+
 |        1 |   Other |
 +----------+---------+

So the result would be:

 +----------+---------+----------------------------+
 |  user_ID | user    |   roles                    |
 +----------+---------+----------------------------+
 |        1 |   Smith |    Admin, Other            |
 +----------+---------+----------------------------+
 |        2 |   Jones |    Staff, Admin, Super     |
 +----------+---------+----------------------------+

Any help would be greatly appreciated.

  • 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-06-01T14:29:30+00:00Added an answer on June 1, 2026 at 2:29 pm

    Try this:

    select t1.user_id, t1.user, group_concat(t2.roles separator ', ') roles
    from t1
    join t2 on t1.user_id = t2.user_id
    group by t1.user_id, t1.user
    

    Check the GROUP_CONCAT documentation for more info.

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

Sidebar

Related Questions

Problem: When adding list item the Value field is being set to the Text
Problem: I have a table that prints out vertical but I would like it
Problem I have an Excel worksheet with a column of text which is data,
Problem I have a file which contains such text (nothing else) 2010-10-05 I would
Problem: If user is not logged into GameCenter account - GameCenter authentication view is
Problem: to combine PATHs with filenames, such that I can easily source many files.
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Problem I need to replace all asterisk symbols('*') with percent symbol('%'). The asterisk symbols
I am currently running into a problem where an element is coming back from
Problem: Get a date inside of a JSONP response that looks like 2012-11-11T04:27:25Z (which

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.