You can use CASE w/i a GROUP BY.
You can also use CASE w/i a SUM to control which values get aggregated. For example:
SELECT
a, b,
SUM(CASE WHEN KTVID = '12345' AND KTVValueType = '02.KTVSCHAF' THEN Value ELSE 0 END) AS KTVID_12345_02_Total,
SUM(Value) AS All_Values_Total
FROM
dbo.tablename
GROUP BY
a, b
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".