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 are all the ddl commands?

1118


What is hibernate and its relation to sql?

1068


how do you login to mysql using unix shell? : Sql dba

1018


How exception handling is done in advance pl/sql?

920


what is a join? : Sql dba

964


What is execution plan in sql?

981


How to assign sql query results to pl sql variables?

995


What is cursor in pl sql with examples?

954


Define commit?

941


Does sql profiler affect performance?

942


What are the different tcl commands in sql?

1106


What is the purpose of the sql select top clause?

1021


What is sql deadlock?

1050


explain advantages of innodb over myisam. : Sql dba

1085


How to download oracle sql developer?

1058