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...

table name :Tab
fields name
1.trx_no (pk)
2.trx_date
3.account code (7 char)
4.account type (1 char)
5.amt
Tab contains account code day wise debit and credit transaction , account type fiels can have 2 value D for debit and c for Credit .

write a query to display the account code wise total debit and credit bal for the month of april 2004.

write a query to display account code wise new amt credit for the april 2004

Answer Posted / jayashree

SELECT SUM(DECODE(ACC_CODE, 'C', AMT)) Total_credit_bal,
SUM(DECODE(ACC_CODE, 'D', AMT)) Total_debit_bal
from tab
where to_char(trx_date,'DD-MON-YYYY') between
'01-apr-2014' and '30-apr-2014';

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the file extension for sql database?

1001


How can you know that statistics should be updated?

1079


Do we need to rebuild index after truncate?

1035


What is cursor and why it is required?

1183


What is embedded sql with example?

1056


what are the advantages of using stored procedures? : Sql dba

1105


How is data stored on a disk?

1036


how many triggers are allowed in mysql table? : Sql dba

1071


What are transaction and its controls?

1040


What do you mean by stored procedures?

1014


Where is sql database stored?

983


How to test for null values?

1052


what is a database lock ? : Sql dba

1172


How do I remove all records from a table?

1075


how to drop an existing index in mysql? : Sql dba

1069