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

  • Home
  • SEARCH
  • 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 8323911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:52:21+00:00 2026-06-08T23:52:21+00:00

Here is some data in table one (persons) Person Table person_ID | Name |

  • 0

Here is some data in table one (persons)

Person Table
person_ID | Name | Address
        1 | JC   | 303 Main Street
        2 | NM   | 444 Nowhere Drive

And table two (Attribute)

Attribute table
person_ID | attribute
    1     |   dog
    1     |   cat
    2     |  bearded

When I join the tables I get the following view:

person_id | name | attribute
    1     |  JC  |   dog
    1     |  JC  |   cat
    2     |  NM  |  bearded

Their is a duplicate row from the left table. It contains the same person_id etc. I want to combine the first two results into one row. Like this:

person_id | name | attribute | attribute
    1     |  JC  |   dog          cat
    2     |  NM  |  bearded       NULL

or this:

person_id | name | attribute 
    1     |  JC  |  dog, cat
    2     |  NM  |  bearded       

Here is some of the code I have tried:

SELECT person.*,Attribute.att FROM `person`,`Attribute` 
WHERE person.`person_id` = Attribute.person_id 
AND name = "" group by person_id

Left Join

Select * from person AS P
LEFT JOIN Attribute AS N
ON P.person_id = N.person_id

Also tried inner join.

  • 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-08T23:52:22+00:00Added an answer on June 8, 2026 at 11:52 pm

    MySQL has a function GROUP_CONCAT that lets you concatenate rows into a string.

    Something like this should work:

    SELECT person.*, (
        SELECT GROUP_CONCAT(attribute SEPARATOR ',')
        FROM Attribute
        WHERE person.id = Attribute.person_id
    ) as attributes
    FROM `person`
    

    I don’t have MySQL on this machine, so I apologize if there are minor mistakes.

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

Sidebar

Related Questions

Some easy points for somebody here, take the following table of data: EventCode ProcessId
I want to move some data from one table to another. I wrote a
I'm trying to insert some data into a table with shell_exec (on localhost). Here's
Trying to archive some data from one database table to another over linked server
I'm trying to aggregate some customer order data into one table for analysis. The
Here is some example data: data = data.frame(series = c(1a, 1b, 1e), reading =
I'm doing some data analytics aggregations and here is my data structures: { 12300
Here is the scenario: I have a visual that displays some data The data
I must transform some XML data into a paginated list of fields. Here is
I am trying to get some form data from POST method. Here's the code

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.