此查询在我的氏族 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
但我想在第二条规则之上添加MannerPoint
.
SELECT TOP 100
IDNum,
IDName,
Nation,
(SELECT SUM(LoyaltyPoint)
FROM USERDATA
WHERE USERDATA.Knights = KNIGHTS.IDNum
AND USERDATA.Authority IN(1, 2)) as ClanLoyalty,
(SELECT SUM(MannerPoint)
FROM USERDATA
WHERE USERDATA.Knights = KNIGHTS.IDNum
AND USERDATA.Authority IN(1, 2)) ) as MannerPoint
FROM KNIGHTS
ORDER BY ClanLoyalty DESC, MannerPoint DESC
但这不起作用并且不显示。
我使用 MSSQL 2005