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 is your daily office routine?
what is meant by urlencode and urldocode? : Sql dba
what is column? : Sql dba
What are the syntax and use of the coalesce function?
What is varchar used for?
What are different types of sql?
What is difference between procedure and trigger?
What is sql in java?
What is the max nvarchar size?
what are date and time data types in mysql? : Sql dba
What sql does db2 use?
what are ddl statements in mysql? : Sql dba
Is sqlite free?
Write the alter statement to enable all the triggers on the t.students table.
how is exception handling handled in mysql? : Sql dba