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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:25:47+00:00 2026-05-12T18:25:47+00:00

I have a MySQL database in which each user has an account, and each

  • 0

I have a MySQL database in which each user has an account, and each account can have multiple permissions.

My ultimate goal is to end up with the account’s username, and a comma-delimited list of permissions ids. There are two ways I can accomplish this:

SELECT a.username, GROUP_CONCAT(rp.permission_id) as permission_ids
FROM account AS a
JOIN role_permission AS rp
ON rp.role_id = a.role_id
WHERE a.id = 1902

… or …

SELECT username
FROM account
WHERE id = 1902;

SELECT permission_id
FROM account_permission
WHERE account_id = 1902

With the single query, I get my results exactly as I want them. With two queries, I have to create the comma-delimited list in the app (PHP) using the second result set.

Are there any performance reasons to NOT choose the first option? I have never used GROUP_CONCAT before, so I don’t know the implications of it, performance-wise.

  • 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-12T18:25:47+00:00Added an answer on May 12, 2026 at 6:25 pm

    The performance should be OK – better than two queries. You need to be aware that the length is limited though:

    The result is truncated to the maximum length that is given by the group_concat_max_len system variable, which has a default value of 1024. The value can be set higher, although the effective maximum length of the return value is constrained by the value of max_allowed_packet. The syntax to change the value of group_concat_max_len at runtime is as follows, where val is an unsigned integer:

    SET [GLOBAL | SESSION] group_concat_max_len = val;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql database which has grown to over 200 tables in it.
I have a MySQL database behind a firewall which can only be accessed via
I have a mysql database which as one of the fields contains a html
I have a PHP web application which uses a MySQL database for object tagging,
I have a MySQL database table with a couple thousand rows. The table is
I have a MySQL database of keywords that are presently mixed-case. However, I want
I have a MySQL database that I want to archive . What is the
I have a mysql database filled up and running on a Windows computer, is
I have a mysql database set as utf-8, and csv data set as utf-8,
I have a MySql database with three tables I need to combine in a

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.