并非所有结果都显示在内部联接的查询中

时间:2014-04-08 16:38:23

标签: mysql sql inner-join

这是我的疑问:

SELECT gang. * , players.Gang, COUNT( players.Gang ) AS total_members, SUM( players.Cash + players.Bank ) AS total_wealth
FROM gang
INNER JOIN players
WHERE players.Gang-1 = gang.gangID
AND gang.gangName != 'none'
GROUP BY gang.gangID
ORDER BY total_wealth DESC 

仅显示3个结果而不是5个结果。

试图获得:

Gang 1 | Total Wealth: $200,000 | Members: 8
Gang 2 | Total Wealth: $100,000 | Members: 5
Gang 3 | Total Wealth: $90,000  | Members: 3
Gang 4 | Total Wealth: $80,000  | Members: 2
Gang 5 | Total Wealth: $90,000  | Members: 1

0 个答案:

没有答案