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

  • Home
  • SEARCH
  • 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 8370073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:49:21+00:00 2026-06-09T13:49:21+00:00

i have two columns business_line(with values X,Y) and business_segment(values X,Y,Z same X and Y

  • 0

i have two columns business_line(with values X,Y) and business_segment(values X,Y,Z same X and Y as business_line) in a table with name “Sometable”. I have another column with name type_of_payment(with values A,B,C,D,E) and a final column with name transaction_value. This is what i want to do:

Sum the transactions grouped by business_line and business_segment and also find out what proportion of these payments were from A,C,E. So my output table would be something like this

                                             (last three columns can be named anything
                                              but they specify proportions of A,C,E)  
Business_line       SUM(transaction_value)   A        C        E
and business seg.
X                   100                      20%      30%      50%
Y                   200                      11%      12%      77%     
X                   300                        and so on
Y                   170
Z                   230

How do i do this??

PS : the sums of A C E need not be 100% as B and D are also present

  • 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-09T13:49:23+00:00Added an answer on June 9, 2026 at 1:49 pm

    This is standard SQL, should work on Oracle (but untested):

    SELECT
       business_line,
       business_segment,
       grand_total,
       A_total * 100.0 / grand_total as A,
       C_total * 100.0 / grand_total as C,
       E_total * 100.0 / grand_total as E
    FROM
       (
           SELECT
              business_line,
              business_segment,
              SUM(transaction_value) as grand_total,
              SUM(CASE WHEN payment_type = 'A' THEN transaction_value END) as A_total,
              SUM(CASE WHEN payment_type = 'C' THEN transaction_value END) as C_total,
              SUM(CASE WHEN payment_type = 'E' THEN transaction_value END) as E_total
           FROM
              SomeTable
           GROUP BY
              business_line,
              business_segment
        ) as t
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two columns. Column E extends up to 99504 (values) and column I
I have two columns say Main and Sub . (they can be of same
I have two columns in my table and the rows are created dynamically. <table
I have two columns(column1, column2) in my oracle database table named as demo .
I have two columns (among others) in a database table: ExitDate and ExitReason. Our
So I have a ExtJs 4 Grid Panel that has two columns. Column ONE
I have two processes that work with data in the same table. One process
I have two columns in my NSOutlineView. One is a Text and image cell
I have two columns in a data frame, and I have been able to
I have two columns, each with many rows/divs. I'm trying to get jQuery UI

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.