Display the total debit counts, total credit counts, sum of
total debits, sum of total credits from an employee's
transaction table (a single table) containing the following
columns.
Transaction_number
Transaction_amount
Transaction_date
Transaction_type --> tells if the amount is a credit or a
debit.
As the query alone is important, the table is left with
specifying just the field's name. Pls help me with this
query.
Answer Posted / deepak mohanty
SELECT SUM(decode(txn_typ,'D',1)) "Total Debit
Count",SUM(decode(txn_typ,'C',1)) "Total Credit Count",
SUM(decode(txn_typ,'D',txn_amt)) "Total Debit
Amount",SUM(decode(txn_typ,'C',txn_amt)) "Total Credit Amount"
from txn_tab
Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
Why use subqueries instead of joins?
How does a self join work?
What is a table?
Define select, insert, create, delete, update, drop keywords
How can we avoid duplicating records in a query?
Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?
How do I run a query in pl sql developer?
What is synchronized subquery?
What is synonyms?
What is an escape character in sql?
How do you clear the screen in sql?
what is sub-query? : Transact sql
What is meant by <> in sql?
What are the sql aggregate functions?
Can pl sql procedure have a return statement?