- SQL code
declare @a int select set @a=a.us+b.uc,[email protected],@a+b.count [email protected]from a inner join b on a.id=b.id这样写是错误的.
------解决方案--------------------
- SQL code
select /*set*/ @a=a.us+b.uc,[email protected],@a+b.count [email protected]from a inner join b on a.id=b.id-- no set
------解决方案--------------------
declare @a int
declare @b int
select @a=(a.us+b.uc) from a,b where a.id=b.id
select @b=count(b.id) from a,b where a.id=b.id
select @[email protected]
------解决方案--------------------
要么set 要么select 写在一起就不对了。
------解决方案--------------------
- SQL code
select @a=a.us+b.uc,[email protected],@a+b.count [email protected]from a inner join b on a.id=b.idset @a=(select (a.us+b.uc) from a inner join b on a.id=b.id)