When posting a question you should provide:
A) Table definition
B) Sample data
C) Expected output based on sample data
You (sort-of) provided A and B: now we need C to be able to help.
Here's how you should post A and B to get replies quickly:
DECLARE @test-2 TABLE (
id int,
name char(1),
amount money,
[type] char(1)
)
INSERT INTO @test-2 VALUES(1, 'a', 120, 'x')
INSERT INTO @test-2 VALUES(2, 'a', 120, 'x')
INSERT INTO @test-2 VALUES(3, 'c', 120.41, 'y')
So, what's the expected output based on this sample data?