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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:33:23+00:00 2026-05-23T00:33:23+00:00

I have two MySQL tables describing data that can be extended into subclasses, one

  • 0

I have two MySQL tables describing data that can be extended into subclasses, one that describes the parent class data and another one describing metadata fields as one-to-many relationships.

Example rows from table page:

id   | name
-----+-----------------------
123  | Example page
999  | Another page

Example rows from table page_metadata:

page_id | key        | value
--------+------------+----------------
123     | picture    | test.jpg
123     | video      | example.avi
123     | sound      | sound.mp3
999     | picture    | something.jpg

Question: Is there some way to fetch all this data in this format?

id   | name             | picture       | video       | sound
-----+------------------+---------------+-------------+------------------
123  | Example page     | test.jpg      | example.avi | sound.mp3
999  | Another page     | something.jpg | NULL        | NULL
  • 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-05-23T00:33:23+00:00Added an answer on May 23, 2026 at 12:33 am
    SELECT pm.page_id as id
      , p.name
      , max(IF(pm.key = 'picture', pm.value, null)) as picture
      , max(IF(pm.key = 'video', pm.value, null)) as video
      , max(IF(pm.key = 'sound', pm.value, null)) as sound
    FROM page p
    INNER JOIN page_metadata pm ON (p.id = pm.page_id)
    GROUP BY p.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two mysql tables: Item containing items that one can buy: CREATE TABLE
Hello I have two mysql tables one that holds username and password second that
I have two mysql tables, one containing details on cars and one containing all
I have two MySql tables as shown below with the data shown: CREATE TABLE
that´s my first question in stackoverflow . I have two MYSQL tables: categories and
I have a mysql problem. I have two tables like this that I need
I have two MySQL tables: One for items and another to log purchases. I'm
I have two mysql tables that have the following structure: Table 1: ---ID---------NAME------- ---1-----
I have two mysql tables sent and queue . I insert members into the
I have two MySQL tables say A and B. A contains just one varchar

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.