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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:14:05+00:00 2026-06-12T16:14:05+00:00

I asked this question in which I explained that I’m trying to get weekly

  • 0

I asked this question in which I explained that I’m trying to get weekly point allocations from members of staff – including those that have allocated zero.

I have two tables:

Staff (140 rows) ID, Firstname, Surname, Position, Faculty, Subject, Hours, Allocation

Transactions (140,000 rows) Transaction_ID, Datetime, Giver_ID, Recipient_ID, Points, Category_ID, Reason

The SQL statement I’ve been trying is this:

SELECT
  CONCAT(s.Firstname, " ", s.Surname) AS `Staff Name`,
  COALESCE(SUM(t.Points), 0) AS `Points Allocated`
FROM staff s
LEFT JOIN transactions t ON t.Giver_ID = s.ID and t.Datetime >='2012-10-08'
GROUP BY s.ID
ORDER BY `Points Allocated` ASC

The query works as intended but it’s taking ~6 seconds to run.

The only index I have on either table is their Primary Keys.

The result of a EXPLAIN on this query states:

Reward System - EXPLAINed query

Sadly, I have no idea what that means! How can I go about optimising my query or tables to improve the run-time of this query?

Thanks in advance,

  • 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-12T16:14:06+00:00Added an answer on June 12, 2026 at 4:14 pm

    Have you tried simply adding an index key on the transaction.Giver_Id and also transaction.dateTime

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

Sidebar

Related Questions

I asked a question regarding Bi linear transformations and received this answer: From that
This question relates to this question which I asked earlier this week. The answer
Earlier I asked this question , which basically asked how to list 10 winners
This is an extension to a question which I asked some time ago. I
I found this on Google, click here , which someone asked a similar question,
I asked this question earlier: How to get delta between two text items But
Following on from a previous question in which I asked: How can I use
I know that this type of question has been asked over and over again,
I guess this question that would have already been asked here. I searched but
This question is related to one I asked the other day which I got

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.