任何人都可以理解为什么我的错误命令不同步。大多数此查询在MSSQL中有效,但我已尝试将其修改为在MySQL中运行。
select pl.playerID, ( IFNull((select SUM(rsAmount) + SUM(rsOtherWinningsValue) from tn_results where playerID=pl.playerID and includedInMoneyList=1) , 0)
+ pl.baseMoney) as totalMoney, pl.firstName, pl.lastName, pl.city, pl.state, pl.baseMoney,
( SELECT count(*)
FROM tn_participants tp INNER JOIN
tournament tn ON tn.tourneyID = tp.tourneyID LEFT OUTER JOIN
registered_player rp ON rp.playerID = tp.playerID
UNION ALL
SELECT count(*)
FROM tn_participants tp INNER JOIN
tournament tn ON tn.tourneyID = tp.tourneyID RIGHT OUTER JOIN
registered_player rp ON rp.playerID = tp.playerID
WHERE tp.playerID = pl.playerID and tn.firstDay >'12/31/(Year(NOW)-1)')
as moneyList from registered_player pl
where pl.divisionId=2
order by totalMoney DESC