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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:15:37+00:00 2026-06-15T12:15:37+00:00

====================================== | InputType | Payable | Amount | pID | ====================================== | Expenses |

  • 0
======================================
| InputType | Payable | Amount | pID |
======================================
| Expenses  | 10,000  | 5,000  |  1  |
--------------------------------------
| Expenses  | 10,000  | 5,000  |  1  |
--------------------------------------
| Expenses  | 10,000  | 5,000  |  2  |
--------------------------------------
| Deposit   | 5,000   | 4,000  |  1  |
--------------------------------------
| Deposit   | 15,000  | 10,000 |  2  |
--------------------------------------

If I want to view the balance like this from the above table:

==============================
| pID | Balance1  | Balance2 |
==============================
| 1   |  24,000  |   15,000  |
------------------------------
| 2   |  20,000  |   20,000  |
------------------------------

Calculation for pID 1:

Payable (Expenses) 10,000+10,000 + Amount (Deposit) 4,000 = Balance1 24,000

Payable (Expenses) 5,000+5,000 + Amount (Deposit) 5,000 = Balance2 15,000

Calculation for pID 2:

Payable (Expenses) 10,000 + Amount (Deposit) 10,000 = Balance1 20,000

Payable (Expenses) 5,000 + Amount (Deposit) 15,000 = Balance2 20,000

  • How to make the calculation after fetching data?
  • 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-15T12:15:38+00:00Added an answer on June 15, 2026 at 12:15 pm

    If InputType can have only two differents status, I think you are looking for something like this:

    select
      pID,
      sum(case when InputType='Expenses' then Payable else Amount end) as Balance1,
      sum(case when InputType='Expenses' then Amount else Payable end) as Balance2
    from tbl
    group by pID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this in the layout xml android:digits=0123456789. android:inputType=phone /> What I want is
I have this EditText definition: <EditText android:layout_height=wrap_content android:layout_width=fill_parent android:inputType=textEmailAddress android:id=@+id/EmailText/> Notice the EditText has
I was expecting something like editText.setInputType(InputType.TYPE_NONE) , but there is no such variable as
I have to different EditText like these : EditText1 has the inputType textCapWords EditText2
In an Android XML file, if I want to combine attributes, say, for inputType
I have an edittext, and when the user clicks this edittext I want to
I want my EditText content type as numeric. I set InputType which is 2
I want an EditText without the autocorrection. I have set the textNoSuggestions inputType, as
i have created my EditTextView with this code: mEditTxtZusatzInfo = new EditTextBackEvent(this); mEditTxtZusatzInfo.setGravity(Gravity.START); mEditTxtZusatzInfo.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
I used android:inputType = phone to take phone number as input, but if i

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.