UPDATE t1
SET t1.field1 = t2.field2Sum
FROM table1 t1
INNER JOIN (select field3, sum(field2) as field2Sum
from table2
group by field3) as t2
on t2.field3 = t1.field3
More Related Contents:
- I dont know sql syntax for my table [closed]
- How do I UPDATE from a SELECT in SQL Server?
- Get top 1 row of each group
- How to calculate age (in years) based on Date of Birth and getDate()
- CROSS JOIN vs INNER JOIN in SQL
- Convert Month Number to Month Name Function in SQL
- Function vs. Stored Procedure in SQL Server
- Multiple INSERT statements vs. single INSERT with multiple VALUES
- Limit on the WHERE col IN (…) condition
- Removing leading zeroes from a field in a SQL statement
- Generate a resultset of incrementing dates in TSQL
- Getting result of dynamic SQL into a variable for sql-server
- How to get difference between two rows for a column field?
- Better techniques for trimming leading zeros in SQL Server?
- How do I split a delimited string so I can access individual items?
- Common Table Expression, why semicolon?
- T-SQL split string based on delimiter
- Counting DISTINCT over multiple columns
- SQL Server SELECT into existing table
- Is there a performance difference between CTE , Sub-Query, Temporary Table or Table Variable?
- How to check if a stored procedure exists before creating it
- How do I prevent a database trigger from recursing?
- What is the Null Character literal in TSQL?
- TSQL – How to use GO inside of a BEGIN .. END block?
- SQL take just the numeric values from a varchar
- SQL Server SELECT INTO @variable?
- WITH CHECK ADD CONSTRAINT followed by CHECK CONSTRAINT vs. ADD CONSTRAINT
- Select a column if other column is null
- Sql Server : How to use an aggregate function like MAX in a WHERE clause
- Date serial in SQL?