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 / prativa mishra
SELECT trans_id,MAX(TRANS_AMOUNT),MIN(TRANS_AMOUNT),DEBIT_CREDIT_INDICATOR
FROM CUSTOMER
GROUP BY TRANS_ID
,DEBIT_CREDIT_INDICATOR
ORDER BY TRANS_ID
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
what is 'mysqld'? : Sql dba
Can a trigger call a stored procedure?
What are the two types of cursors in pl sql?
explain the difference between bool, tinyint and bit. : Sql dba
Why stored procedures are faster than query?
Is ms sql is free?
what are the nonstandard string types? : Sql dba
What is a behavioral trigger?
What are literals in sql server?
What is a loop in sql?
Explain the commit statement.
what are the maximum number of rows that can be constructed by inserting rows directly in value list? : Transact sql
What are the limitations of sql express?
what is the difference between myisam static and myisam dynamic? : Sql dba
How do I run a sql script?