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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does view store data in sql?

702


what happens if you no create privilege in a database? : Sql dba

718


Is sql port 1433 encrypted?

778


What is sql partition function?

801


What is the usage of when clause in trigger?

759






Does sqlite need a server?

741


What is difference between pls_integer and integer?

711


what is a trigger in mysql? Define different types of trigger. : Sql dba

733


How to select 10 records from a table?

841


how can you see all indexes defined for a table? : Sql dba

716


What is localdb mssqllocaldb?

803


How do you add a column to a table?

772


Does sql full backup truncate logs?

747


Write a sql query to get the third highest salary of an employee from employee_table?

833


Is truncate ddl or dml?

751