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.
pls give me answer. i want urgent
Answer Posted / srinu.g
SELECT
trans_id,MAX(TRANS_AMOUNT),MIN(TRANS_AMOUNT),DEBIT_CREDIT_INDICATOR
FROM CUSTOMER WHERE DEBIT_CREDIT_INDICATOR='cr'
UNION ALL
SELECT
trans_id,MAX(TRANS_AMOUNT),MIN(TRANS_AMOUNT),DEBIT_CREDIT_INDICATOR
FROM CUSTOMER WHERE DEBIT_CREDIT_INDICATOR='db'
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Can we create a trigger on view?
Is pl sql different from sql?
What is the file extension for sql database?
Is sql a microsoft product?
How to fix oracle error ora-00942: table or view does not exist
Is sql low level language?
What does the argument [or replace] do?
Does a user_objects view have an entry for a trigger?
How does sql profiler work?
What is sql*loader and what is it used for?
What is the process of copying data from table a to table b?
What is microsoft t sql?
How would you reference column values before and after you have inserted and deleted triggers?
what is csv? : Sql dba
What is the difference between row level and statement level trigger?