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


Please Help Members By Posting Answers For Below Questions

What are sql queries used for?

536


How do I install microsoft sql?

531


Can we call stored procedure in function?

552


how to use like conditions? : Sql dba

575


What is the use of index in hive?

548






What is offset in sql query?

596


What is the difference between drop and truncate commands?

490


Is primary key an index?

535


what does it mean to have quoted_identifier on? : Sql dba

679


What are sql commands?

505


which tcp/ip port does sql server run on? : Sql dba

517


Is pl sql a scripting language?

590


What is the difference between join and natural join?

473


What is group function in sql?

537


what is self join and what is the requirement of self join? : Sql dba

683