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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:56:48+00:00 2026-05-16T02:56:48+00:00

================= This is my query: SELECT SUM(sub_total) AS sales, CASE WHEN (sub_total<100) THEN ‘0-99’

  • 0

=================

This is my query:

SELECT 
SUM(sub_total) AS sales,
CASE    WHEN (sub_total<100) THEN '0-99'    
    WHEN (sub_total>=100 AND sub_total<200) THEN '100-199'  
    WHEN (sub_total>=200 AND sub_total<300) THEN '200-299'  
    WHEN (sub_total>=300 AND sub_total<400) THEN '300-399'  
    WHEN (sub_total>=400 AND sub_total<500) THEN '400-499'  
    ELSE '500+'
END
AS product_sales_range
FROM order_item 
GROUP BY sub_total

========================

It gives the ressult as:

sales       product_sales_range
-----       -------------------

10398.96        200-299
600         100-199
300         0-99
7699.78     300-399
6799.32     100-199
600         0-99
26599.24        500+

==========================================

I would like to get the result like this :

sales       product_sales_range sales_increase_by_10%   sales_increase_by_20%
-----       ------------------- ------------------  ------------------

10398.96        200-299
600         100-199
300         0-99
7699.78     300-399
6799.32     100-199
600         0-99
26599.24        500+

============

Requirement:

Currently we have sales figures. Need to find out the sales projection as if the sales will be increased by 10%, 20%, 30% etc. Example: today the sales for product_sales_range (0-99) is 300. If the sales is increased by 10%, sales_increase_by_10% should be 330

  • 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-16T02:56:49+00:00Added an answer on May 16, 2026 at 2:56 am

    Am I missing something, or do you just need to use:

      SELECT SUM(sub_total) AS sales,
             CASE WHEN (sub_total<100) THEN '0-99' 
                  WHEN (sub_total>=100 AND sub_total<200) THEN '100-199' 
                  WHEN (sub_total>=200 AND sub_total<300) THEN '200-299' 
                  WHEN (sub_total>=300 AND sub_total<400) THEN '300-399' 
                  WHEN (sub_total>=400 AND sub_total<500) THEN '400-499' 
                  ELSE '500+'
             END AS product_sales_range,
             SUM(sub_total) * 1.1 AS sales_increase_by_10Percent,
             SUM(sub_total) * 1.2 AS sales_increase_by_20Percent
        FROM order_item 
    GROUP BY sub_total
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query SELECT currency_code, SUM(CASE WHEN TYPE = 'buy'THEN to_amount END )
Hi guys i have this query SELECT currency_code, SUM( CASE WHEN TYPE = 'cash_in'
Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
I have a MySQL query like this: SELECT *, SUM(...some SQL removed for brevety)
I have a MySQL query like this: SELECT DAYNAME(CreatedAt) AS TheDay, SUM(Amount) AS TheSum
I have this query: SELECT p.text,se.name,s.sub_name,SUM((p.volume / (SELECT SUM(p.volume) FROM phrase p WHERE p.volume
this query SELECT SUM(s.msg_sent_datetime - r.date_received) AS difference returns -743726381625992.000000 but if i add
What would be the equivalent Excel formula of this SQL query SELECT SUM(a) FROM
How can I make this query work : SELECT column1.....,SUM(Hits) AS Hits FROM table
I have this query in T-SQL 2008: SELECT a.Amount / ( SELECT SUM(b.Amount) FROM

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.