查询不返回任何内容?

时间:2013-09-09 10:27:07

标签: sql-server

此查询在我的部落php排名脚本中正确显示。

SELECT TOP 100 
  IDNum, 
  IDName, 
  Nation, 
  (SELECT SUM(LoyaltyPoint) 
   FROM USERDATA 
   WHERE USERDATA.Knights = KNIGHTS.IDNum 
     AND USERDATA.Authority IN(1, 2)) as ClanLoyalty 
FROM KNIGHTS 
ORDER BY ClanLoyalty DESC

但我想在LoyaltyPoint的{​​{1}}第二条规则之上添加。

MannerPoint

但这不起作用,也不显示。

我使用MSSQL 2005

1 个答案:

答案 0 :(得分:1)

这里有一个额外的括号;

AND USERDATA.Authority IN(1, 2)) ) as MannerPoint

删除了额外括号的调整后代码:

AND USERDATA.Authority IN(1, 2) ) as MannerPoint