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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:44:42+00:00 2026-06-14T10:44:42+00:00

I have 2 tables like so: —————————————————– | PLACES | —————————————————– | Id |

  • 0

I have 2 tables like so:

-----------------------------------------------------
| PLACES                                            |
-----------------------------------------------------
| Id             | Name          | Address          |
-----------------------------------------------------
| 1              | Parc          | 20 King St       |
| 2              | Bar           | 33 Main St       |
-----------------------------------------------------

-----------------------------------------------------
| PEOPLE                                            |
-----------------------------------------------------
| Id             | Place_id (fk) | Name             |
-----------------------------------------------------
| 1              | 2             | Luke             |
| 2              | 1             | Han              |
| 3              | 1             | Chewie           |
-----------------------------------------------------

I want to display every places with their associated people. To do so I though it would be great to have a single record per place with an list of people (instead of having the same place for each people entry).

I’m really not familiar with SQL queries so I tried using Right Join and Group By without any positive results.

SELECT plc.name, plc.address, plp.name 
        FROM places plc
            RIGHT JOIN people plp
                ON plp.place_id = plc.id
                    GROUP BY plc.name;

The results I got after doing “$query->fetchAll();” in PHP were something like that:

Object {name: "Bar", address: "33 Main St", name: "Luke"}
Object {name: "Parc", address: "20 King St", name: "Han"}
Object {name: "Parc", address: "20 King St", name: "Chewie"}

I guess the best solution possible would be to have something filtered like that, which would prevent additional work both from the backend and frontend side. However, I have absolutely no idea if it’s possible:

Object {name: "Bar", address: "33 Main St", name: "Luke"}
Object {name: "Parc", address: "20 King St", name: ["Han", "Chewie"]}

Any advices or suggestions on how I could achieve this? 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-14T10:44:43+00:00Added an answer on June 14, 2026 at 10:44 am

    easiest way would be to use group_concat

    select
      place.id as `Id`,
      place.address as `address`,
      GROUP_CONCAT(people.name) as `peopleList`
    from
      place,
      peoples
    where
      place.id=people.place_id
    group by
      place.id
    

    and, if you see your results getting cropped, you can increase the size limit of GROUP_CONCAT like this:

    SET SESSION group_concat_max_len = 8192;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables like this: table a: [id, name, roll, address, mark] table
hi i have tables like this: Persons: person_id, name then i have many langauge
I have two tables like so; id_image foo bar 1 3 5 2 8
I have three tables like this: Person table: person_id | name | dob --------------------------------
I have tables like tbl_biodata: id : int value=>1 name : varchar(50) value =>
I have tables like that in Datagridview: Name Money ------------- Hi 100 //here Combobox
I have three tables like this: Person id | name | location ----------------------- 1
have tables like this Table checklist idCardno name permAddress datetime Table persons name idcardno
I have Two tables like this: Table categories: columns: id, name, parent 1, Foods,
I have two tables like : Docs {#DocId, SomeData} KeyValues {#RowId, DocId, Name, Value}

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.