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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:48:32+00:00 2026-06-10T20:48:32+00:00

I have the following (little bit long) query : SELECT * FROM client C

  • 0

I have the following (little bit long) query :

 SELECT * 
        FROM client C
        JOIN uga U
        ON U.id_uga = C.id_uga
        JOIN appartenance A
        ON A.id_uga = U.id_uga
        JOIN serviceattribuee SA
        ON SA.id_client = C.id_client
        JOIN service S
        ON S.id_service = SA.id_service
        WHERE A.id_utilisateur = 28
        ORDER BY ville_client

Which returns me something like :

Nom : "Test" 
Adresse : "Test"
Services : "Service 1"

Nom : "Test" 
Adresse : "Test"
Services : "Service 2"


Nom : "Test 2"
Adresse : "Test 2"
Services : "Service 1"

Nom : "Test 2"
Adresse : "Test 2"
Services : "Service 2"

The thing is, as you can see, the results are duplicated, because there’s several services for each client.
Is there a way to concat all the services into the same row for each client, in order to avoid doubles ?

I’m using MySQL5.5

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-06-10T20:48:33+00:00Added an answer on June 10, 2026 at 8:48 pm

    I think what you are looking for is GROUP_CONCAT with a GROUP BY clause. In order to use it well, you will need to specifically enumerate the columns you want to concat (I’ve shown here a sample, you can adapt to your needs:

    SELECT 
      C.*
      GROUP_CONCAT(S.Nom) as `services`
    FROM client C
      JOIN uga U
      ON U.id_uga = C.id_uga
      JOIN appartenance A
      ON A.id_uga = U.id_uga
      JOIN serviceattribuee SA
      ON SA.id_client = C.id_client
      JOIN service S
      ON S.id_service = SA.id_service
    WHERE A.id_utilisateur = 28
    GROUP BY C.id
    ORDER BY ville_client
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query: SELECT * FROM versions WHERE path LIKE '%/dir1%' that
I have the following little bit of MySQL code CREATE VIEW UserResults AS SELECT
I have the following code setup: http://jsfiddle.net/bABHU/2/ Had to change it a little bit
I am little bit confused about following problem & their solutions: i have 2
I have a little bit complex MySQL query for me and i can't figure
I have a little bit of problem here: I have the following js functions:
I could use a little bit of help on the following matter: I have
The title is a little confusing so I will explain. I have the following
I'm having a little difficulty understanding alias_method / alias_method_chain . I have the following
I have a little confusion in the following two statements. The below program is

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.