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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:27:50+00:00 2026-05-18T09:27:50+00:00

I basically have three different classes of items that I want to show on

  • 0

I basically have three different classes of items that I want to show on a users wall: ratings, comments, and updates. This three are completey different entities, but because they all can appear on a users wall, I just call them “wallitem”. The all have a timestamp property, which represents the date they were created.

I want to enable users to page through the wallitems, ordered by the timestamp. For example: last 10 wallitems. Or wallitems 20 to 30. Is there an MySQL Query that gives me the last 10 “wallitems”, even though all different entities have different columns?

I could imagine, getting a list of items back, where each item has all the properties of all different entities, an additional property defining the type (for example “rating”), if it is in fact a rating, all other properties are just null. I would love to use such a dicationary in my php code:

foreach ($wallItemArray as $item) {
  if ($item['type'] == "rating") {
    $rating = $item; // use it as normal "rating"-entity
  } else if ($item['type'] == "comment") {
    $comment = $item; // use it as normal "comment"
  } 
// and so on for all different entities that could represent a wallitem in this context
}
  • 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-18T09:27:51+00:00Added an answer on May 18, 2026 at 9:27 am

    Something like

    SELECT 'rating' AS type, value AS r_val, NULL AS c_val
    FROM Rating
    
    UNION
    
    SELECT 'comment' AS type, NULL AS r_val, comment_text AS c_val
    FROM Comment
    

    would get you started

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

Sidebar

Related Questions

I have two functions that do the basically same thing on two different classes....
I basically have three tables, posts, images and postimages (this simply contains the ids
I have this page which has three peson searchs on them. Basically it's a
I have a mysql table with three columns: username, location, timestamp. This is basically
In our product, we have frames that are basically three inheritance levels down from
Basically I have three different Core Data entities ( A , B , C
I have a base class that three classes inherit from. Whenever these child classes
I have an old Access database that is basically one flat file. I want
I have an application that uses several different Java classes and would like to
Basically I have some class objects, each with three properties. Once one class object

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.