in order for people to help you you will need to provide the following so that they do not have to recreate your scenario. CREATE TABLE giveme (Measure_Group NVARCHAR(22), Measure_Number INT , Eligible_INstances int, Reporting_Rate int)INSERT INTO givemeSELECT 'A', 1, 100, 100UNION ALLSELECT 'A', 2, 110, 88UNION ALLSELECT 'B', 3, 100, 100UNION ALLSELECT 'B', 4, 110, 100
Try this for startersSELECT Measure_Group MeasureGroupID,SUM(Measure_Number) 'measure-group-total', COUNT(*) icount, Eligible_INstances ,Reporting_Rate FROM mamaGROUP BY Measure_Group, Measure_Number, Eligible_INstances, Reporting_RateFOR XML PATH(''),ROOT If you don't have the passion to help people, you have no passion