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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:59:52+00:00 2026-05-22T00:59:52+00:00

I have a table where I keep users numbers and their score user_number |

  • 0

I have a table where I keep users numbers and their “score”

user_number | score
  0832824       6
  0478233       3
    ...        ...

The score goes from 3 to 15. I want to create a query that would fetch the score and the total of users with this score. But I need to make four different groups of score : 12 to 15, 8 to 11, 5 to 7 and less than 5.

Sort of like this :

  score  | total_users
12 to 15      5000
 8 to 11      3000
   ...         ...

Thanks for any answer you can provide!

  • 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-22T00:59:53+00:00Added an answer on May 22, 2026 at 12:59 am
    SELECT t.range AS score, COUNT(*) AS total_users from 
    (   
        SELECT CASE WHEN score BETWEEN 12 AND 15 THEN '12 to 15'     
                    WHEN score BETWEEN 8 AND 11 THEN '8 to 11' 
                    WHEN score BETWEEN 5 AND 7 THEN '5 to 7'    
                    WHEN score < 5 THEN 'less than 5' 
               END AS range   
        FROM scores) t 
    GROUP BY t.range 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a couple of triggers on a table that I want to keep
Say I have a table like this: create table users ( user_id int not
I have table with 50 entries (users with such details like Name Surname Location
I have table rows of data in html being filled from a CGI application.
I have a table story_category in my database with corrupt entries. The next query
I have a table called changes which contains a list of record numbers the
If all tables I want to delete from have the column gamer_id can i
I have a table that I use to keep track of customer usage. I
I have a payments table that has a user_id and an amount. Users have
I have a postgresql (v8.4) table with login id and timestamps, and I want

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.