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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:26:20+00:00 2026-06-03T12:26:20+00:00

I am trying to get a query to show all the data for event

  • 0

I am trying to get a query to show all the data for event prizes on one line. For example this is an example of my table.

Event_id    Place    Money
101         1        120
101         2        60
101         3        30
102         1        100
102         2        50
102         3        25

What I want is for the results to look like the following:

Event_id    First    Second    Third
101         120      60        30
102         100      50        25

Any help to accomplish this would be greatly appreciated.

  • 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-03T12:26:26+00:00Added an answer on June 3, 2026 at 12:26 pm

    Hope this helps.

    SELECT    Event_ID,
              GROUP_CONCAT(IF(place = 1, `money`, NULL)) `First`,
              GROUP_CONCAT(IF(place = 2, `money`, NULL)) `Second`,
              GROUP_CONCAT(IF(place = 3, `money`, NULL)) `Third`
    FROM      tableName
    GROUP BY  event_id
    

    If you want learn more about sql tricks, visit this:

    Common but Useful MySQL Queries

    SEE on SQLFiddle

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

Sidebar

Related Questions

I'm trying to get the IsAdmin Value with SQL query(This query return 1 line
I'm having problems trying to get a query like this table answers CREATE TABLE
I'm trying to get the output of the query 'SHOW TABLES FROM database_name' into
I'm trying to get this working and the query executes but nothing comes back.
Hello guys i am trying to show all the users pokemon were the table
I'm trying to get the query string from a string (not the current URL).
I am trying to get my query to grab multiple rows while returning the
I am trying to get my linq query to replicate my t-sql but I
I am trying to get a regular query appended to any clean URL to
I am trying to get a default query to implement upon page load but

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.