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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:45:42+00:00 2026-05-22T12:45:42+00:00

I have a table like this: Table A Customer InvoiceNo Region Type Amount A001

  • 0

I have a table like this:

Table A             
Customer    InvoiceNo       Region  Type    Amount
A001        10001           Europe  FG      100
B001        10002           Asia    FG      200
C001        10003           America MISC    50
D001        10004           Asia    FG      300
A001        10005           Europe  MISC    20
C001        10006           America MISC    10
B001        10007           Asia    FG      300

I wish to split the Amount into 2 columns, namely Sales_Amt & Misc. The Region is not required.
The result that I wish to have should look like this:

Customer    InvoiceNo       Type    Sales_Amt MISC
A001        10001           FG      100       0
B001        10002           FG      200       0
C001        10003           MISC    0         50
D001        10004           FG      300       0
A001        10005           MISC    0         20
C001        10006           MISC    0         10
B001        10007           FG      300       0 

Thanks.

  • 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-22T12:45:43+00:00Added an answer on May 22, 2026 at 12:45 pm

    That’s pretty simple:

    select
        Customer, 
        InvoiceNo, 
        Type, 
        decode(Type, 'MISC', 0, 1) * Amount as Sales_Amt, 
        decode(Type, 'MISC', 1, 0) * Amount as Misc
    from
        TableA
    ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table like this (Oracle, 10) Account Bookdate Amount 1 20080101 100
Let's say I have a table like this: Customer,Invoice Type,Balance A,Good,50 A,Good,10 A,Bad,20 B,Good,20
I have a table like this: UserID Customer ID status 1 1 1 1
I have a table that looks like this: Customer ID, MDN, Plan, StartDate, EndDate,
Let's say I have a table called Customer, defined like this: Id Name DepartmentId
I have a table in my database formatted like this: customer old_code new_code C1
I have table like this : ID Name_1 Name_2 Name_3 1 Egon Spengler Ives
Imagine I have table like this: id:Product:shop_id 1:Basketball:41 2:Football:41 3:Rocket:45 4:Car:86 5:Plane:86 Now, this
I have a table like this: <table> <tfoot> <tr><td>footer</td></tr> </tfoot> <tbody> <tr><td>Body 1</td></tr> <tr><td>Body
I have a table like this: Application,Program,UsedObject It can have data like this: A,P1,ZZ

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.