我对此请求有疑问:
SELECT
CASE WHEN ApNumber=0 THEN 0
WHEN ApNumber=1 THEN 100
WHEN ApNumber=2 THEN 250
WHEN ApNumber=3 THEN 500
WHEN ApNumber=4 THEN 750
WHEN ApNumber<=5 THEN 1000 END AS ApPoint,
FactionInfo.FactionUUID
FROM
(
SELECT COUNT(isAP) AS ApNumber
FROM ClaimInfo
WHERE FactionOwnerUUID =FactionInfo.FactionUUID
)f0,
FactionInfo
问题在于
FactionInfo.FactionUUID
WHERE FactionOwnerUUID =FactionInfo.FactionUUID
中的
产生未知列错误。
问题是我想要执行位于FactionInfo中的所有行的select中的所有计算。 建议?
最终请求应该给我:
FactionUUID - ApPoint
----------------------
FactionUUIDName 250
FactionUUIDOtherName 750
答案 0 :(得分:0)
你似乎想要:
SELECT (CASE WHEN COUNT(isAP) = 0 THEN 0 -- this will never happen
WHEN COUNT(isAP) = 1 THEN 100
WHEN COUNT(isAP) = 2 THEN 250
WHEN COUNT(isAP) = 3 THEN 500
WHEN COUNT(isAP) = 4 THEN 750
ELSE 1000
END) AS ApPoint,
ci.FactionOwnerUUID
FROM ClaimInfo ci
GROUP BY ci.FactionOwnerUUID;