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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:43:56+00:00 2026-05-25T06:43:56+00:00

I have table called comments with following structure: id | entry_id | date |

  • 0

I have table called comments with following structure:

id | entry_id | date | comment

I also have a table called entries with following structure:

entry_id | title | date | entry

I just want to show recent comments and entries, to which these comments were added.

Now I’m using this query:

SELECT c.id,
       c.date,
       c.comment,
       e.entry_id,
       e.title
FROM   entries e
       INNER JOIN comments c
        ON e.entry_id = c.entry_id
GROUP  BY c.date DESC
LIMIT  50

And I output the results so:

#entry_id
  1 hour ago:
  Some comment

#entry_id
  2 hours ago:
  Some comment    

Comments are ordered by date. What I’m trying to do is simply group comments by same entry_id, e.g.:

#entry_id
  1 hour ago:
  Some comment

  2 hours ago:
  Some comment without  repeating the `entry_id`

#other entry_id
  5 hours ago:
  Some comment

How would I do that? No need to write a code for me, just say how would you do that (in pseudo code, for example). This is comments grouping like on facebook or google+ stream, I hope you understand what I mean.

  • 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-25T06:43:56+00:00Added an answer on May 25, 2026 at 6:43 am

    Used this: Grouping arrays in PHP

    I think I shouldn’t write so much details about my MySQL tables structure, done it with PHP and arrays. Thanks to all for attention.

    $groups = array();
    
    foreach($items as $item)
        $groups[$item['value']][] = $item;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this mysql table called comments which looks like this: commentID parentID type
I have a table called BlogPost which has a 1-to-many relationship with the Comment
I have a table called ApprovalTasks... Approvals has a status column I also have
I have a table called PurchaseOrderDetail. TABLE PurchaseOrderDetail PurchaseOrderDetail int, Comments nvarchar(500) In the
If you have a table called posts, which contains id, title, content .etc, how
I have two tables called 'events' and 'topics' each table can have many comments.
I have a MySQL table comment with the following fields: loginid submissionid points I
Sooo basically I have a table called Comment. On that table I have three
Basically what I have is a comments MySQL table. I have a column called
I have a table called Transactions with the following schema: ColumnName DataType Constraints ----------

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.