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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:28:44+00:00 2026-06-12T09:28:44+00:00

I have a question that I cannot find answer to. Basically, I have two

  • 0

I have a question that I cannot find answer to.

Basically, I have two columns:

variable 10  || 14  || 18 || 20 || 29  || 38 || 39  || 41 || 46  ...
values   857 || 736 || 84 || 1  || 362 || 74 || 183 || 77 || 944 ...

I want to output the sum of all the values in each variable with 10s (10, 14, 18) then 20s (20, 29) then 30s (38, 39) so on and so forth.

How would I construct the query?

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

    try this:

    select variable div 10, sum(values) 
      from myTable
     group by variable div 10
    

    result (assuming your columns are named var and val now:

    mysql> select var div 10, sum(val) from my  group by var div 10;
    +------------+----------+
    | var div 10 | sum(val) |
    +------------+----------+
    |          1 |     1677 | 
    |          2 |      363 | 
    |          3 |      257 | 
    |          4 |     1021 | 
    +------------+----------+
    4 rows in set (0.00 sec)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a relatively simple question that I cannot seem to find the answer
I have a question that I cannot find an answer. I'm constructing a very
I would have another question I cannot find answer on. I know that the
I have very simple question that I cannot find the answer to. In the
I have a really simple question that I cannot find a straightforward answer for.
I am learning C++ and have got a question that I cannot find the
1) My question is that, when i have two large table which cannot be
I have a question that is probably very simple, but I cannot find an
I have a question which I cannot find an answer to. I'm experimenting with
This is a simple question, however one that I cannot find the answer to.

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.