SELECT version ,bill_cust ,ship_cust ,part ,promo ,terms ,plnt ,r_currency ,c_currency ,requestdate - orderdate rdiff ,shipdate - requestdate sdiff ,sum(fb_qty) fb_qty ,sum(fb_val_loc) fb_val_loc ,sum(fb_cst_loc) fb_cst_loc FROM rlarp.osm WHERE AND calc_status <> 'CANCELED' GROUP BY version ,bill_cust ,ship_cust ,part ,promo ,terms ,plnt ,r_currency ,c_currency ,requestdate - orderdate ,shipdate - requestdate