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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:59:30+00:00 2026-06-11T13:59:30+00:00

Here is my table structure with data id actor_id created_at updated_at 729 80 2012-09-10

  • 0

Here is my table structure with data

    id     actor_id   created_at              updated_at 

    729    80         2012-09-10 17:05:59    2012-09-10 17:05:59
    731    80         2012-09-10 17:04:02    2012-09-10 17:04:02
    725    139        2012-09-06 13:59:08    2012-09-06 13:59:08
    724    76         2012-09-06 11:31:30    2012-09-06 11:31:30
    723    29         2012-09-06 09:40:22    2012-09-06 09:40:22
    719    29         2012-09-06 09:24:02    2012-09-06 09:24:02
    811    80         2012-09-02 17:05:59    2012-09-10 17:05:59
    812    80         2012-09-01 17:04:02    2012-09-10 17:04:02

This is the result of

SELECT  `te`.`id`, te.actor_id, te.created_at, te.created_at
FROM `timeline_events` AS te
ORDER BY 
    te.created_at DESC
    LIMIT 10

I need group it by actor_id and created_at

Here is what i need in the end

    id    actor_id     created_at          updated_at             count

    729    80       2012-09-10 17:05:59    2012-09-10 17:05:59     2
    725    139      2012-09-06 13:59:08    2012-09-06 13:59:08     1
    724    76       2012-09-06 11:31:30    2012-09-06 11:31:30     1
    723    29       2012-09-06 09:40:22    2012-09-06 09:40:22     2
    812    80       2012-09-10 17:04:02    2012-09-10 17:04:02     2

Can someone guide me how to do this?

Many thanks in advance

UPD To simplify i will put another example

So say i have next rows

1                                             1 (count: 2)
1
3                                             3 (count: 1)
4
4     => after magic function it should be    4 (count: 2)
1
1                                             1 (count: 3)
1
6                                             6 (count: 2)
6
4                                             4 (count 3)
4
4

So it should split by groups.

UPD 2
I need this query for rendering timeline. Right now it show all info what user did, but i need group it.

Before

  • user1 upload photo
  • user1 changed information
  • user2 updated bio
  • user3 uploaded photo
  • user3 updated bio
  • user1 update bio

After

  • user1 uploadd photo and changed infomarion
  • user2 updated bio
  • user3 uploaded photo and updated bio
  • user1 updated bio
  • 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-11T13:59:31+00:00Added an answer on June 11, 2026 at 1:59 pm

    I find solution by myself

    Here is the query

    SET @i = 0;
    SELECT
        COUNT(`wrapper`.`id`) AS 'count',
        GROUP_CONCAT(`wrapper`.`type` SEPARATOR ',') as 'types'
    FROM (
        SELECT  
            @prev := (
                SELECT prev_te.actor_id
                FROM `timeline_events` AS prev_te
                WHERE prev_te.created_at > te.created_at
                ORDER BY prev_te.created_at ASC
                LIMIT 1
            ) AS 'prev_actor_id',
            IF(
                @prev = te.`actor_id` OR @prev IS NULL, 
                @i, 
                @i := @i + 1
            ) AS 'actor_id_group',
            `te`.*
        FROM `timeline_events` AS te
        ORDER BY 
            te.created_at DESC, 
            te.id DESC
    ) AS `wrapper`
    GROUP BY `wrapper`.`actor_id_group`
    LIMIT 10
    

    And here is the proof link 😉

    This website really helped me

    I am using wrapper for grouping purpose, because mysql didn’t group by variables, if someone know better solution, please let me know

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

Sidebar

Related Questions

Here is a table structure (e.g. test): Field Name Data Type id BIGINT (20)
Here is my table structure and data: CREATE TABLE event ( EventID INT(11) NOT
here is table structure table1 pk int, email character varying(100)[] data 1, {'mr_a@gmail.com', 'mr_b@yahoo.com',
Here is the simplified table structure of PRICES : SKU PriceType FromDate ToDate Price
I have a KVP Table and the structure is ID, Key, Value. Here are
Lets say we have a table here, populated with the following data: acc_id1 acc_id2
So firstly here is the relevant table structure: TUBE_VIDEOS ------ id video_name TAGS ----
I have this table/data structure: ID Area Postcode ------------------------ 1 Area 1 EN1 1NE
I have a database table structure as follow: datatype data mytable now datatype has
Below is my table structure and data... id receiver caller category playfilename 1 4564165

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.