select r.requestId, sum( forecast_qty ) cases, sum( forecast_amt ) dollars from tbl_MFR_TPF_Detail#_tpfSuffix# tpf left outer join tbl_TPM_Requests r on r.requestId = tpf.rebateContractId where tpf.tpartnerType = 'CDR' and tpf.tpartnerId = and tpf.mfr_id = and 'MFR' = and tpf.forecast_status in ( 'A', 'C' ) group by r.requestId select * from qmd_data where deleteRow = 'N' order by dollars desc