Need some clarification on SELECT within UPDATE t-SQL statement
sql, sql-server, sql-update, t-sql
Solution
2! Your subquery SELECT pulls the value as determined before the UPDATE makes any changes.
Problem
Say, if I have the following t-SQL statement (designed to run on SQL Server 2008): ``` UPDATE tbl SET col1 = ( SELECT MAX(col1) FROM tbl AS t1 WHERE t1.type = tbl.type ); ``` How exactly does SELECT work in this case: It selects taking into account the results of each UPDATE, or It selects from the tbl as it was before the UPDATE began updating records. Can someone clarify this for me?