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
What are sql injection vulnerabilities?
What is the purpose of normalization?
Is sql a backend?
Can we use insert statement in function?
What is an exception in pl/sql?
what is data control language? : Sql dba
What is oracle pl sql developer?
How do I create a memory optimized filegroup?
What is meant by cursor in sql?
Is a view faster than a stored procedure?
How many types of primary keys are there?
What is the full form of sql?
How do I copy a table in sql?
What are the parts of a sql statement?
What are the different dml commands in sql?