I have a view with the following fields: cust_subtotal, last_cust_sub, branch_code, cust_id and cust_name. I need to group all records in which the cust_subtotal + last_cust_sub is less than 2500 under the name "Others" and the sum of all those records to be included in the cust_subtotal and last_cust_subtotal columns by Branch and customer_name.
Here is an example:
cust_name cust_id branch_code cust_subtotal last_cust_sub
ACME A012 PPE 250 1100
BIGGY B124 FFR 3000 1200
FRAMES F235 PPE 2400 50
NAILS N257 FFR 1500 1100
UTOPIA U975 FFR 600 900
YOYO Y864 PPE 3000 0
I would like to see
cust_name cust_id branch_code cust_subtotal last_cust_sub
FFR
BIGGY B124 FFR 3000 1200
NAILS N257 FFR 1500 1100
OTHERS Others FFR 600 900
PPE
OTHERS Others PPE 2650 1150
YOYO Y864 PPE 3000 0
Is there a way for me to select the above fields from the view and have it grouped and summed as outlined above?
Thanks!
Here is an example:
cust_name cust_id branch_code cust_subtotal last_cust_sub
ACME A012 PPE 250 1100
BIGGY B124 FFR 3000 1200
FRAMES F235 PPE 2400 50
NAILS N257 FFR 1500 1100
UTOPIA U975 FFR 600 900
YOYO Y864 PPE 3000 0
I would like to see
cust_name cust_id branch_code cust_subtotal last_cust_sub
FFR
BIGGY B124 FFR 3000 1200
NAILS N257 FFR 1500 1100
OTHERS Others FFR 600 900
PPE
OTHERS Others PPE 2650 1150
YOYO Y864 PPE 3000 0
Is there a way for me to select the above fields from the view and have it grouped and summed as outlined above?
Thanks!