MySQL - Select rows with approximate interval -


i run website dedicated tracking statistics of players on online game. 1 of functions of website build charts them track progress on past 2000 games.

what i'm doing using query records, using php select records in increments of approximately 100 battles, until have 20 records need build charts:

select distinct battles, victories, survived, destroyed, detected,         hitratio, damage, capture, defense, avg_exp, efficiency    account_stats   account_id = xxxxxxx     , battles >= zzzzzzz; 

zzzzzzz current number of battles minus 2000. i'm using distinct because database can keep duplicate values (this because of historical functions).

the reason must use approximate values because data game's api, during 1 check, might have played multiple games. means in database, "battles" count of varying increments.

using query above killing database server since creates lot of temporary tables on disk, bringing entire website crawl.

so question is: there way can select 20 rows in database, selecting rows closest 100 battles previous, without using distinct / group / creates temporary tables on disk?

thanks in advance!


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -