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.

Answers were Sorted based on User's Feedback



i have a customer table. trans_id trans_date trans_amt debit_credit_indicator 001 01-..

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

i have a customer table. trans_id trans_date trans_amt debit_credit_indicator 001 01-..

Answer / ajit

select ac_no, max(AC_STATUS) high,min(AC_STATUS) low,ac_branch
from DIM_ACCOUNt
where ac_branch = 'cr'
and ac_no = 1
group by ac_no, ac_branch
union
select ac_no, max(AC_STATUS) high,min(AC_STATUS) low,ac_branch
from DIM_ACCOUNt
where ac_branch = 'cr'
and ac_no = 2
group by ac_no, ac_branch
union
select ac_no, max(AC_STATUS) high,min(AC_STATUS) low,ac_branch
from DIM_ACCOUNt
where ac_branch = 'db'
and ac_no = 2
group by ac_no, ac_branch
union
select ac_no, max(AC_STATUS) high,min(AC_STATUS) low,ac_branch
from DIM_ACCOUNt
where ac_branch = 'db'
and ac_no = 1
group by ac_no, ac_branch;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

what is the need of the cursor attribute notfound..(because using found attribute we can complete the task......found + negation operator = not found )

2 Answers   Tech Mahindra,


What are properties of the transaction?

0 Answers  


Who is the owner of mysql database?

0 Answers  


What is replication id?

0 Answers  


What are sql injection vulnerabilities?

0 Answers  






can we update a view which is created from two tables

11 Answers  


Are sql views compiled?

1 Answers  


what is a cursor

9 Answers   IBM, TCS, Wipro,


What is data abstraction in sql?

0 Answers  


what are the join types in tsql? : Transact sql

0 Answers  


what is switch column,colums cost in oracle?

0 Answers   Metric Stream,


What does := mean in pl sql?

0 Answers  


Categories