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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:49:26+00:00 2026-06-18T05:49:26+00:00

I have a situation in which i need to group the applicant based on

  • 0

I have a situation in which i need to group the applicant based on some column value
(shown below) and find the count of that group.
Currently the query is returning only those columns which has a count of more than 0.

What modification should be done to the query so that it shows all groups and its counts as zero?

Query:

select Applicant_info.range as [Income Range], count(*) as [Total Students],order_number =
          CASE range
             WHEN 'Did not specify' THEN '1'
             WHEN '0-25000' THEN '2'
             WHEN '25001-50000' THEN '3'
             WHEN '50001-75000' THEN '4'
             WHEN '75001-100000' THEN '5'
             WHEN '100001-200000' THEN '6'
             WHEN '200000 and Above' THEN '7'
          END
    from (
      select case  
        when Annual_Income is null or Annual_Income = '' then 'Did not specify' 
        when Annual_Income between 0 and 25000 then '0-25000'
        when Annual_Income between 25001 and 50000 then '25001-50000'
        when Annual_Income between 50001 and 75000 then '50001-75000'
        when Annual_Income between 75001 and 100000 then '75001-100000'
        when Annual_Income between 100001 and 200000 then '100001-200000'
        when Annual_Income > 200000 then '200000 and Above'
        end as range
      from Applicant_info)Applicant_info
    group by Applicant_info.range
    order by order_number
  • 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-18T05:49:27+00:00Added an answer on June 18, 2026 at 5:49 am

    Use a separate CASE expression for each one like this:

    Select 
      range as [Income Range], 
      SUM(CASE when Annual_Income is null or Annual_Income = '' then END) AS 'Did not specify',
      SUM(CASE when Annual_Income between 0 and 25000 then 1 ELSE 0 END) AS '0-25000',
      SUM(CASE when Annual_Income between 25001 and 50000 then 1 ELSE 0 END) AS '25001-50000',
      SUM(CASE when Annual_Income between 50001 and 75000 then 1 ELSE 0END) AS  '50001-75000',
      SUM(CASE when Annual_Income between 75001 and 100000 then 1 ELSE 0 END) AS  '75001-100000',
      SUM(CASE when Annual_Income between 100001 and 200000 then 1 ELSE 0END) AS  '100001-200000',
      SUM(CASE when Annual_Income > 200000 then 1 ELSE 0 END) AS  '200000 and Above'
    from Applicant_info
    GROUP BY range;
    

    Note that: This SUM function is actually a count, because it sums either 0 or 1.

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

Sidebar

Related Questions

I have a situation in which I need to convert a text data into
I have an odd situation in which I need to modify the position of
I have a situation where I need to retrieve data from a query which
I have a situation in which a managed DLL calls some unmanaged DLL. I
I have a situation in which the ideal relationship, I believe, would involve Value
I have a situation in which i need a reference to the very next
I have this situation were I need to include Persons inside a Group. For
I have a situation in which i need to do insert queries for every
My situation is that I have two Classes : Person and Group. In every
I have a situation in which i need to select all descendants of a

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.