I have the following query.

```
 UPDATE A SET A.[a]=A.[a]+C.value
FROM Table A INNER JOIN 
(SELECT ID, STUFF((SELECT ','+P1.value FROM Table P1 WHERE P1.ID=P2.ID AND DATEDIFF(MI,LASTUPDATED,GETUTCDATE()) <=15  FOR XML PATH(''),TYPE).VALUE('(./TEXT())[1]','VARCHAR(MAX)'),1,1,'') AS alias FROM Table P2 ) P3
ON A.[ID]=P3.ID

```

So I want to insert ID and strings values which is fetched from the select statement in the above query to another table.
I know the way were this objective can be attained i.e.

```
insert into tablename(columns)
select (columns) from table.

```

So I want to incorporate the same thing in my nested query, which hypothetically should look like.

```
 UPDATE A SET A.[a]=A.[a]+C.value
    FROM Table A INNER JOIN 
    (INSERT INTO Tablename(ID,Value)
    (SELECT ID, STUFF((SELECT ','+P1.value FROM Table P1 WHERE P1.ID=P2.ID AND DATEDIFF(MI,LASTUPDATED,GETUTCDATE()) <=15  FOR XML PATH(''),TYPE).VALUE('(./TEXT())[1]','VARCHAR(MAX)'),1,1,'') AS alias FROM Table P2 )) P3
    ON A.[ID]=P3.ID

```

This is not working in my case. How should I do this