slight tweak to match Ops requirementSELECT SumMoney, money AS MinMoney, groupid,recIDFROM(SELECT SUM(money) OVER(PARTITION BY groupId) AS SumMoney, money, groupId, ROW_NUMBER() OVER(PARTITION BY groupid ORDER BY money) AS RN, recIDFROM tableA)s WHERE RN = 1
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs