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


Please Help Members By Posting Answers For Below Questions

What are sql injection vulnerabilities?

500


What is the purpose of normalization?

535


Is sql a backend?

549


Can we use insert statement in function?

516


What is an exception in pl/sql?

544






what is data control language? : Sql dba

588


What is oracle pl sql developer?

532


How do I create a memory optimized filegroup?

529


What is meant by cursor in sql?

546


Is a view faster than a stored procedure?

545


How many types of primary keys are there?

529


What is the full form of sql?

534


How do I copy a table in sql?

517


What are the parts of a sql statement?

555


What are the different dml commands in sql?

586