我目前有一个我无法弄清楚的 SQL Server 问题。
错误是:
为变量赋值的 SELECT 语句不得与数据检索操作结合使用
SQL:
DECLARE @IdUser INT
Select
@IdUser = Id,
Username,
(Select Count(*) From GagsLikes where Userid = @IdUser And Good = 1) as GagLikes,
(Select Count(*) From GagsViews where UserID = @IdUser),
(Select Count(*) From Gags Where UserID = @IdUser) as GagViews
From
Users
Order by
GagLikes, GagViews
提前致谢!