Mysql选择和不同的值

时间:2012-02-23 12:33:43

标签: mysql

我有一个问题:

SELECT count(itemlogger2_finds.player_id) AS ile, itemlogger2_finds.player_id, 
itemlogger2_players.name FROM itemlogger2_finds, itemlogger2_players WHERE 
itemlogger2_finds.method='-1' AND itemlogger2_finds.time>'1329951599'  AND 
itemlogger2_finds.time<'1330556399' AND itemlogger2_players.id = itemlogger2_finds.player_id 
GROUP BY itemlogger2_finds.player_id ORDER BY 1 DESC LIMIT 10;

表 itemlogger2_finds:

player_id | method | time

itemlogger2_players:

id | name

现在,当我使用我的查询时,显示名称,player_id和项目计数

itemlogger2_finds.time>'1329951599'  AND 
    itemlogger2_finds.time<'1330556399'

我需要同时计算3件物品。

示例:

player_id | method | time
1         | -1     | 1329951699
1         | -1     | 1329951699
1         | -1     | 1329951699
1         | -1     | 1329951699
1         | -1     | 1329951699

现在我的计数是5,我需要同时计算3次。

0 个答案:

没有答案