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 / ajit
Also u can use count function to calculate total debit & credit cout.
and u can use this sql stmt
select tran_type, Count(tran_type) total,
(select sum(tran_amt)
from tran
where tran_type = 'D') sumofde,
(select sum(tran_amt)
from tran
where tran_type = 'C') sumofce
from tran
group by tran_type;
Is This Answer Correct ? | 0 Yes | 10 No |
Post New Answer View All Answers
What are sql queries used for?
How do I install microsoft sql?
Can we call stored procedure in function?
how to use like conditions? : Sql dba
What is the use of index in hive?
What is offset in sql query?
What is the difference between drop and truncate commands?
Is primary key an index?
what does it mean to have quoted_identifier on? : Sql dba
What are sql commands?
which tcp/ip port does sql server run on? : Sql dba
Is pl sql a scripting language?
What is the difference between join and natural join?
What is group function in sql?
what is self join and what is the requirement of self join? : Sql dba