I have a table test3 which has the data below. I want to apply aggregate function based on status.
request mkt_val fill_val qty fill_qty rate c_party status
------- ------- -------- --- -------- ---- ------- ------
IBM 200 100 20 10 1 test1 Accept
IBM 300 200 30 20 2 test1 Accept
IBM 400 300 40 30 3 test1 Accept
IBM 500 400 50 40 4 test2 Reject
IBM 600 500 60 50 5 test2 Reject
I need output with the columns:
- request
- a_sum_mkt_val
- a_avg_fill_qty
- a_min_rate
- r_sum_mkt_val
- r_avg_fill_qty
- r_min_rate
- c_cnt (distinct c_party for request)
- total_req (total number of records for request)
Prefix a_ for accept, r_ for reject. For the sample data, the output should be:
IBM 900 20 1 1100 45 4 2 5
I am not able to categorise the value based on the status.