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 / apoorva garg
select count(decode(trim(transaction_type),'D',1)) total_debits,
count(decode(trim(transaction_type),'C',1)) total_credits,
sum(decode(trim(transaction_type),'D',transaction_amount)) total_debits_amt,
sum(decode(trim(transaction_type),'C',transaction_amount)) total_credits_amt
from transaction
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is db journal file?
what are all the different normalizations? : Sql dba
What is an example of translating a date into julian format?
What company owns postgresql?
Is it possible to link two groups inside a cross products after the cross products group has been created?
What is a temporal data type?
What is sql constant?
What is compute?
What are all the ddl commands?
What is the purpose of design view?
How many disk partitions should I have?
What does pl sql developer do?
How do temporal tables work?
What pl/sql package consists of?
What is sql stand for?