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 do I order columns in sql?
What is scalar and vector?
Write the alter statement to enable all the triggers on the t.students table.
What is sql partition?
what are the different tables present in mysql? : Sql dba
what is a database? : Sql dba
What is pessimistic concurrency control? : Transact sql
What is composite primary key in sql?
What is the difference between joins?
what is denormalization. : Sql dba
What are all the ddl commands?
How do I find sql profiler?
What does (*) mean in sql?
What is a heap in sql?
How do I trace sql profiler?