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 is data types in sql?

697


How is a PL/SQL code compiled?

859


How to connect a sql*plus session to an oracle server?

815


what is blob? : Sql dba

731


write an sql query to get third maximum salary of an employee from a table named employee_table. : Sql dba

719






What do you mean by rowid?

700


What is a schema? How is it useful in sql servers?

788


How do I create a sql database?

708


what are string data types? : Sql dba

693


what are the security recommendations while using mysql? : Sql dba

759


what is the difference between union and union all? : Sql dba

718


What does partition by mean in sql?

682


Is stored procedure faster than query?

727


what is a foreign key ? : Sql dba

780


how to add a new column to an existing table in mysql? : Sql dba

770