Two columns whith diffrent conditins in the same query

hello,
Below is a table I have that shows reporting data to the tax Authorities by Taxpayer, gross amount and tax amount

id type amount
1 net 100
1 tax 30
2 net 120
2 tax 50
3 net 140
3 tax 70

Below is the query I use to report the gross amount

sellect id,sum(amount) as gross
from table1

Below is the query I use to report the tax amount

sellect id,sum(amount) as tax
from table1
where type ='tax'

How can ן create a single query that will show the following data?

id gross tax
1 130 30
2 170 50
3 210 70

hi

hope this helps

create data script

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

image


SELECT id,
    SUM(AMOUNT) AS gross,
    SUM(CASE WHEN TYPE = 'tax' THEN AMOUNT ELSE 0 END) AS tax
FROM @TAX
GROUP BY id
ORDER BY id

thank you.