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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:26:06+00:00 2026-06-12T07:26:06+00:00

I have a table with a one to many mapping from ID to some_value

  • 0

I have a table with a one to many mapping from ID to some_value. What query can give me all of some_value for a particular ID?

I can use any array, string, or other object useful in SQL as the final result in list_of_values. You don’t need to use my comma seperated format.

My particular varient of SQL is Hive, but the syntax and functions are very similar to MySQL 🙂

Starting table:

ID             some_value
-----------    ------------
1              a
1              b
1              c
2              x
2              y
2              z
2              a
3              g
3              h

Finished table:

ID              list_of_values
----------      ----------------
1               a, b, c
2               x, y, z, a
3               g, h
  • 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-12T07:26:07+00:00Added an answer on June 12, 2026 at 7:26 am
    SELECT ID, COLLECT_SET(some_value) AS list_of_values
        FROM YourTable 
        GROUP BY ID;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table, has many rows. for example one of from rows(all rows
I have a table, has many rows. for example one of from rows(all rows
I have a database with many tables and one particular table has columns: name
I have a table with a one to many mapping to a table that
I have a table Submission, which has a many to one mapping to a
I have 2 table t1 -> t2 (common one to many relationship) with 140.000
I have a table which has several one to many relationships with other tables.
Lets say I have a Customers table and an Orders table with a one-to-many
I have a table of many values where one column has the WO Number,
I have two tables connected with one to many relationship. Parent Table is 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.