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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:05:16+00:00 2026-05-17T21:05:16+00:00

I actually don’t even know how to call this :P, but… I have one

  • 0

I actually don’t even know how to call this :P, but…

I have one table, let’s call it “uploads”

id    owner    date
-----------------------------
0     foo      20100101120000
1     bar      20100101120300
2     foo      20100101120400
3     bar      20100101120600
..    ..       ..
6     foo      20100101120800

Now, when I’ld do something like:

SELECT id FROM uploads ORDER BY date DESC

This would result in:

id    owner    date
-----------------------------
6     foo      20100101120800
..    ..       ..
3     bar      20100101120600
2     foo      20100101120400
1     bar      20100101120300
0     foo      20100101120000

Question: Nice, but, I want to go even further. Because now, when you would build a timeline (and I did :P), you are ‘spammed’ by messages saying foo and bar uploaded something. I’ld like to group them and return the first result with a time-limit of ‘500’ at the date-field.

What kind of SQL-command do I need that would result in:

id    owner    date
-----------------------------
6     foo      20100101120800
3     bar      20100101120600
0     foo      20100101120000

Then, after that, I can perform a call for each record to get the associative records in a timeframe of 5 minutes (this is an exmaple for id=6):

SELECT id FROM uploads WHERE date>=20100101120800-500 ORDER BY date DESC

Does anyone now how I should do the first step? (so limiting/grouping the results)

(btw. I know that when I want to use this, I should convert every date (YmdHis=60) to Unix-time (=100), but I don’t need the 5 minutes to be exactly 5 minutes, they may be a minute less sometimes…)

  • 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-17T21:05:17+00:00Added an answer on May 17, 2026 at 9:05 pm

    I’m not quite clear on the result you are trying to get, even with your examples. Perhaps something with rounding and group by.

    SELECT max(id) max_id,owner, (ROUND(date/500)*500) date_interval, max(date) date
    FROM uploads GROUP BY date_interval,owner
    

    You may want to use FLOOR or CEILING instead of ROUND, depending on what you want.

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

Sidebar

Related Questions

I don't know if it's actually possible to do, but I have a text
I hate to give the question this heading but I actually don't know whats
I don't know if variadic is actually the right word, but I'm talking about
I haven't actually done this yet, and maybe I don't need to, but it
I am getting this runtime error from a new project. I actually don't have
I'm newbie to TypoScript. I actually don't know how to make link like this:
Somehow my master and my origin/master branch have diverged. I actually don't want them
There are similar questions, but none answers what I really need. I actually don't
First: apologies for the question title, I don't actually know what the problem is
I've got a queue (actually 3 different queues but I don't believe that will

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.