DECLARE @TAX TABLE (ID INT , TYPE VARCHAR(10), AMOUNT INT)
INSERT INTO @TAX SELECT 1,'net',100
INSERT INTO @TAX SELECT 1,'tax',30
INSERT INTO @TAX SELECT 2,'net',120
INSERT INTO @TAX SELECT 2,'tax',50
INSERT INTO @TAX SELECT 3,'net',140
INSERT INTO @TAX SELECT 3,'tax',70
SELECT A.ID, A.SM as GROSS
, B.AMOUNT as TAX
FROM
(SELECT ID, SUM(AMOUNT) AS SM FROM @TAX GROUP BY ID ) A
JOIN
(SELECT ID, AMOUNT FROM @TAX WHERE TYPE = 'TAX' ) B
ON A.ID = B.ID