sounds like thisSELECTCOALESCE(hsc_product_group_category.product_group_catagory,CASE WHEN hsc_p21_view_inv_mast.class_id3 IS NULL THEN 'MISC' ELSE 'EQUIPMENT' END) 'product category',ROUND(SUM([detail_price]),2) AS 'sales',ROUND(SUM([detail_cogs]),2) AS 'cogs',((SUM(detail_price))-(SUM(detail_cogs)))as 'profit'FROM [P21].[dbo].[p21_sales_history_report_view]LEFT OUTER JOIN hsc_p21_view_inv_mast ON [p21_sales_history_report_view].inv_mast_uid = hsc_p21_view_inv_mast.inv_mast_uidLEFT OUTER JOIN hsc_product_group_category ON [p21_sales_history_report_view].product_group_id = hsc_product_group_category.product_group_idWHERE period = 6 ANDyear_for_period = 2012 ANDparent_oe_line_uid = 0 AND(invoice_adjustment_type='C' AND [p21_sales_history_report_view].source_type_cd = 2638 OR NOT (invoice_adjustment_type = 'C' OR invoice_adjustment_type = 'D'))--AND [p21_sales_history_report_view].vendor_consigned = 'N' AND projected_order = 'N' AND (detail_type IS NULL OR detail_type = 0) --AND (progress_bill_flag = 'N' OR progress_bill_flag IS NULL )GROUP BYCOALESCE(hsc_product_group_category.product_group_catagory, ,CASE WHEN hsc_p21_view_inv_mast.class_id3 IS NULL THEN 'MISC' ELSE 'EQUIPMENT' END)
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/