на основании ограниченной информации в исходном вопросе, попробуйте:
DECLARE @YourTable table(MemberID int, SchemeName varchar(10), BenefitID int, BenefitAmount int)
INSERT INTO @YourTable VALUES (10,'ABC' ,1,10000)
INSERT INTO @YourTable VALUES (10,'ABC' ,1,2000)
INSERT INTO @YourTable VALUES (10,'ABC' ,2,5000)
INSERT INTO @YourTable VALUES (10,'A.B.C',3,11000)
INSERT INTO @YourTable VALUES (11,'ABC' ,1,10000)
INSERT INTO @YourTable VALUES (11,'ABC' ,1,2000)
INSERT INTO @YourTable VALUES (11,'ABC' ,2,5000)
INSERT INTO @YourTable VALUES (11,'A.B.C',3,11000)
INSERT INTO @YourTable VALUES (10,'mnp',3,11000)
INSERT INTO @YourTable VALUES (11,'mnp' ,1,10000)
INSERT INTO @YourTable VALUES (11,'mnp' ,1,2000)
INSERT INTO @YourTable VALUES (11,'mnp' ,2,5000)
INSERT INTO @YourTable VALUES (11,'mnp',3,11000)
SELECT
MemberID, REPLACE(SchemeName,'.','') AS SchemeName
,SUM(CASE WHEN BenefitID=1 THEN BenefitAmount ELSE 0 END) AS B1
,SUM(CASE WHEN BenefitID=2 THEN BenefitAmount ELSE 0 END) AS B2
,SUM(CASE WHEN BenefitID=3 THEN BenefitAmount ELSE 0 END) AS B3
FROM @YourTable
GROUP BY MemberID, REPLACE(SchemeName,'.','')
ORDER BY MemberID, REPLACE(SchemeName,'.','')
ВЫХОД:
MemberID SchemeName B1 B2 B3
----------- ----------- ----------- ----------- -----------
10 ABC 12000 5000 11000
10 mnp 0 0 11000
11 ABC 12000 5000 11000
11 mnp 12000 5000 11000
(4 row(s) affected)