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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:45:10+00:00 2026-06-15T13:45:10+00:00

I have a database table like so: id | donation_type | donation_amount | time_inserted

  • 0

I have a database table like so:

id | donation_type | donation_amount | time_inserted
1    em1              20                2012-12-07 10:01:00
2    em1              50                2012-12-07 10:01:00
3    em1              100               2012-12-07 10:01:00
4    em1              150               2012-12-07 10:02:00
5    em1              100               2012-12-07 10:02:00
6    em1              30                2012-12-07 10:02:00
7    em1              40                2012-12-07 10:03:00
8    em1              65                2012-12-07 11:16:00

I would like a query to count how many donations where made in each minute.
I would also like to sum the donation amount made in that minute.

So the result I would like to be returned (using the above table would be):

10:00:01 => 3, amount => 170 # 3 donations in 10:01:00, totaling £170
10:00:02 => 3, amount => 280 # 3 donations in 10:02:00, totaling £280
10:00:03 => 1, amount => 40 # 1 donation in 10:03:00, totaling £40
11:16:00 => 1, amount => 65 # 1 donation in 11:16:00, totaling £40

EDIT – Example I would like returned by the SQL query

# Example of what I would like returned..

time                  |  donation_count  | donation_sum_in_minute
2012-12-07 10:01:00           3                  170
2012-12-07 10:02:00           3                  280
2012-12-07 10:03:00           1                  40
2012-12-07 11:16:00           1                  65  #the next hour!

I am using the below query to grab the total sum of donations since 10am. But I would like to also group them by minute to give me the result example above.

SELECT SUM(donation_amount) 
FROM `DONATION` 
WHERE `time_inserted` > '2012-12-07 10:00:00' 
AND `donation_type` = 'em1';
Returns: 807,563 # the total sum of donations since 10am today.
  • 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-15T13:45:10+00:00Added an answer on June 15, 2026 at 1:45 pm
    SELECT 
      SUM(donation_amount) AS total_donation_amount,
      EXTRACT(YEAR from time_inserted) AS year,
      EXTRACT(MONTH from time_inserted) AS month,
      EXTRACT(DAY from time_inserted) AS day,
      EXTRACT(HOUR from time_inserted) AS hour,
      EXTRACT(MINUTE from time_inserted) AS minute
    FROM `DONATION`
    WHERE `time_inserted` > '2012-12-07 10:00:00' 
    AND `donation_type` = 'em1'
    GROUP BY year, month, day, hour, minute;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table with thousands of rows. I would like to run
Assume I have a database table with many names. I'd like to flex match
i have database table like this +-------+--------------+----------+ | id | ip | date |
that my problem: I have database table like that: id (AI) market_id 1 6
Say I have a database table like the following: FileID | FileName | FileSize
Let's say you have a database with a single table like... --------------------------------------------- | Name
I always forget how to do things like this. I have a database table
I have a MySQL database table called Participant that looks something like this: (idParticipant)
I have a mysql database with a table structure like below : Table Name
I have one large database table of request data, much like Apache request logs,

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.