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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:45:26+00:00 2026-06-14T09:45:26+00:00

Question for the mysql gurus out there: I have a data set that lists

  • 0

Question for the mysql gurus out there:

I have a data set that lists labor rates and the date on which the rate begins. These rates may be hourly, daily, weekly, or even monthly. (i.e someone worked 1 weeks at a weekly rate of $700/week starting on Nov 6th)

I’m trying to build a graph that charts daily spending over time. I have a simple sum and group query. However the weekly and monthly rates are skewing it. In the example above, all $700 lands on Nov 6th, when truly only one day’s worth ($100) of the $700 was spent.

The data set is very large, so I’m trying to let mysql do as much of the heavy lifting as possible, rather than having to loop through each row. However, if there is a conservative way to solve this programmatically, rather than through a monster query, I’m open to it.

Pretty hairy, right? Any ideas?

If this can’t be answered, my backup plan is just to store all data in terms of its daily rate, but the original rate type (week, month) will be stored as well, so that rate can be returned to.

  • 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-14T09:45:28+00:00Added an answer on June 14, 2026 at 9:45 am

    I had to deal with this exact same issue, except it was based on hours work falling across the midnight mark.

    Anyhow, business logic is what is important, it seems you want to calculate 1 week at X dollars as $(1/7)X per day.

    What I would do is split this query up, first do the hourly/daily – easy, its all one day. Then do the weekly/monthly and first get the middle data which is easy. Then get the beginning-6, beginning-5, . . beginning-1 (for weekly), to start calculating the days that are in the range that you want.

    If you want, you can union all these queries to get one return set.

    But probably best to do it outside of mysql, you will have finer grain control. Then you can just return all your data and loop through it all real fast to process the head and tail ends.

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

Sidebar

Related Questions

I have a MySQL question that I think must be quite easy. I need
I have a mysql question. I have an application which I am migrating to
i have table question (mysql with php) which contains question,category(multiple) and subcat(multiple) its belong.
I have a follow up to complicated mysql question that I recently asked: Show
PHP and mySQL question I hope you could help me out with. I have
I have a short access/mySQL question. I have a mapping table on the format
I have 2 mysql tables : Question with the following columns : id, question,
I have a question about my mysql query. I want to count the number
The question I have is kind of simular to this one - MySQL select
I have the same tables as in this question: MySql query over many-to-many relationship

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.