Try
;with counts
AS
(
SELECT total, COUNT(*) as dos
FROM temp_table2010
WHERE total in (select id from #temp)
)
UPDATE T
SET dos=counts.dos
FROM #temp T
INNER JOIN counts
ON t.id = counts.total
More Related Contents:
- PL SQL UPDATE STATEMENT
- How can I do an UPDATE statement with JOIN in SQL Server?
- Reason for Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause [duplicate]
- Is there any difference between GROUP BY and DISTINCT
- How to use count and group by at the same select statement
- must appear in the GROUP BY clause or be used in an aggregate function
- GROUP BY to combine/concat a column [duplicate]
- JOIN two SELECT statement results
- updating table rows in postgres using subquery
- Group by month and year in MySQL
- how can I Update top 100 records in sql server
- Return pre-UPDATE column values using SQL only
- SQL Group by & Max
- SQL UPDATE order of evaluation
- SQL to Entity Framework Count Group-By
- SQL Server Update Trigger, Get Only modified fields
- Use SELECT inside an UPDATE query
- PostgreSQL Where count condition
- I want to use CASE statement to update some records in sql server 2005
- GROUP BY without aggregate function
- MySQL GROUP BY behavior
- SQL: How do you select only groups that do not contain a certain value?
- Update a column of a table with a column of another table in PostgreSQL
- Get values from first and last row per group
- Update query using Subquery in Sql Server
- How to return a incremental group number per group in SQL
- Oracle: Updating a table column using ROWNUM in conjunction with ORDER BY clause
- How to get list of values in GROUP_BY clause?
- Update rows in one table with data from another table based on one column in each being equal
- Why doesn’t Oracle SQL allow us to use column aliases in GROUP BY clauses?