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
How delete a row in sql?
What is an oracle stored procedure?
Is sql database free?
how to show all tables with 'mysql'? : Sql dba
What is a sql*loader control file?
What is the difference between a query and a report?
What is recursive stored procedure?
The in operator may be used if you know the exact value you want to return for at least one of the columns.
what is text? : Sql dba
Can a table have no primary key?
What is the use of count (*) in sql?
What is sql dialect?
How to run sql commands in sql*plus?
What is trigger explain with example?
What trigger means?