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
What are all the ddl commands?
What is hibernate and its relation to sql?
how do you login to mysql using unix shell? : Sql dba
How exception handling is done in advance pl/sql?
what is a join? : Sql dba
What is execution plan in sql?
How to assign sql query results to pl sql variables?
What is cursor in pl sql with examples?
Define commit?
Does sql profiler affect performance?
What are the different tcl commands in sql?
What is the purpose of the sql select top clause?
What is sql deadlock?
explain advantages of innodb over myisam. : Sql dba
How to download oracle sql developer?