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
Answers were Sorted based on User's Feedback
Answer / ritika yadav
select account_code,account_type, sum (amt)
from tab
where to_char(trx_date,'DD-MM-YYYY') between '01-04-2014' and '30-04-2014'
group by account_code, account_type
order by account_code, account_type;
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / 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 |
Give the structure of the function ?
How to connect a sql*plus session to an oracle server?
What cursor type do you use to retrieve multiple recordsets?
17 Answers Apollo, CTS, IonIdea, Microsoft, Oracle, TCS, Vmoksha, Wipro,
How do you modify a table in sql?
I want to execute a piece of code before calling a procedure. How to achieve it?
what is msql? : Sql dba
Can we use having without group by in sql?
what is a relationship and what are they? : Sql dba
how to create user in sql and how to set password for that?
What is auto increment in sql?
Explain what is a database?
table - new_no old_no 2345 1234 3456 2345 5678 4567 output sud be -new_no 1234 2345 3456 4567 5678