i have a customer table.
trans_id trans_date trans_amt debit_credit_indicator
001 01-JAN-13 1099 cr
001 12-JAN-13 500 db
002 24-FEB-13 400 db
002 23-MAR-13 345 cr
001 18-APR-13 800 cr
002 15-MAR-13 600 db
001 12-FEB-13 200 cr

i want like this output.

trans_id trans_amt debit_credit_indicator

i want get highest credit amount and lowest credit amount
and highest debit amount and lowest debit amount for each
trans_id.

Answer Posted / prativa mishra

select
trans_id,debit_credit_indicator,max(trans_amount),min(trans_am
ount) from customer1
group by trans_id,debit_credit_indicator
order by trans_id

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between my sql and sql?

527


What action do you have to perform before retrieving data from the next result set of a stored procedure ?

2088


What is delete command in sql?

554


What company owns postgresql?

558


How do you explain an index?

784






What is example of database?

512


how to shut down the server with 'mysqladmin'? : Sql dba

541


how to get a list of all tables in a database? : Sql dba

507


What is update query?

546


How can we debug in PL/SQL?

655


When is the update_statistics command used?

569


When is the explicit cursor used ?

588


What operators deal with null?

605


Why self join is used in sql?

494


how to concatenate two character strings? : Sql dba

548