SQL Error:An aggregate may not appear in the set list of an UPDATE statement.
2010-01-08 13:38
1196 查看
原来sql语句:
update [dbo].[TableA]
set ColumnA=Count(*)
from [dbo].[TableB]
改后:
update [dbo].[TableA]
set ColumnA=tmpTable.ColumnB
from(
select Count(*) as ColumnB
from [dbo].[TableB]
)tmpTable
update [dbo].[TableA]
set ColumnA=Count(*)
from [dbo].[TableB]
改后:
update [dbo].[TableA]
set ColumnA=tmpTable.ColumnB
from(
select Count(*) as ColumnB
from [dbo].[TableB]
)tmpTable
相关文章推荐
- ERROR: The version of SQL Server in use does not support datatype 'datetime2'.
- error: declaration may not appear after executable statement in block
- mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': You have an error in your SQL syntax; check the manual t
- KeilMDK 编译报错:error: #268: declaration may not appear after executable statement in block
- ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregate
- 【complier】error: #268: declaration may not appear after executable statement in block
- invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
- 20100507 学习记录: Server Error in '/' Application. Object reference not set to an instance of an object
- 利用Mysql进行update时,出现You have an error in your SQL syntax check the manual that corresponds to your My
- Column \'表名.某列名\' is invalid in the select list because it is not contained in either an aggregate f
- error: declaration may not appear after executable statement in block
- Column \'表名.某列名\' is invalid in the select list because it is not contained in either an aggregate f
- Error: The version of SQL Server in use does not support datatype 'datetime2
- error: declaration may not appear after executable statement in block
- stm32:error: #268: declaration may not appear after executable statement in block
- keil中变量声明问题及error: #268: declaration may not appear after executable statement in block
- error: declaration may not appear after executable statement in block
- Which of the following expression(s) will NOT cause an error when used to replace the ***** in the C
- error: #268: declaration may not appear after executabl statement in block
- Error: The version of SQL Server in use does not support datatype 'datetime2'