我用下面的查询SQL Server 2000中集团在SQL Server 2000中工作,但不能在SQL Server 2005
SELECT
U.FirstName,
SUM(VE.Score)AS Score, SUM(VE.QuizTime) AS Time,
SUM(VE.IsQuizType) AS QuizesAttempted,
SUM(VE.IsProgrammingType) AS ProgrammingProblemsAttempted
from
Users U INNER JOIN VirtualExercise VE on U.UserID=VE.UserID
where U.UserID IN(10,11) AND ProgramID = 2
group by U.FirstName
order by VE.Score desc
它工作正常,在SQL Server 2000,但在SQL Server不工作2005 给出了以下错误:
Column "VirtualExercise.Score" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause. --- Inner Exception
请帮助...
但我的查询在SQL Server 2000中完美运行。它仅在SSQL Server 2005中发生错误。 – jitendra