SQL Query : Update from a select result
<p>Here's my sql query </p>

<pre><code>UPDATE dbo.TD_TOTAL_ACCOUNTS SET Total_Accounts = Total 
SELECT annee, mois,[Group],
(
 SELECT SUM(Accounts_Number) 
FROM olap.TD_ALL_ACCOUNTS 
WHERE EOMONTH(cast( cast(mois as nvarchar(2))+ '/' + '01'  + '/' + cast(annee as nvarchar(4)) as DATETIME)) &lt;= EOMONTH(cast( cast(T2.mois as nvarchar(2))+ '/' + '01'  + '/' + cast(T2.annee as nvarchar(4)) as DATETIME)) AND [Group] = T2.[Group]
) AS Total 
FROM olap.TD_ALL_ACCOUNTS AS T2
</code></pre>

<p>The "Total" column is not recognized. I can't manage to name the table resulting from the select T3 and use it in the SET "Total_Accounts = T3.Total" </p>

<p>Thank you in advance.</p>