Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How delete a row in sql?

923


What is an oracle stored procedure?

985


Is sql database free?

923


how to show all tables with 'mysql'? : Sql dba

1058


What is a sql*loader control file?

1158


What is the difference between a query and a report?

900


What is recursive stored procedure?

1045


The in operator may be used if you know the exact value you want to return for at least one of the columns.

1025


what is text? : Sql dba

1006


Can a table have no primary key?

1008


What is the use of count (*) in sql?

977


What is sql dialect?

1035


How to run sql commands in sql*plus?

1080


What is trigger explain with example?

979


What trigger means?

926