php - getting highest values in a data set -
php - getting highest values in a data set -
i taking gps info , drawing map, show maximum speed @ various points. need maintain track of speed value each info point , if decreases mark previous point max value.
is nicely in mysql, or loop though in php , values. quite simple via php, includes pulling out loads of info not required.
one info set 20k rows give or take few thousand.
from graph below expect 4 info points back. table construction simple id, long, lat, speed (not matters much)
edit: id uuid, not integer :/
assuming have ids > 0:
select id, speed ( select if(speed<@speed,@id,0) id, if(speed<@speed,@id:=0,@id:=id) ignoreme, @speed:=speed speed (select @speed:=0) initspeed, (select @id:=0) initid, yourtable ... ) baseview id>0 this compare lastly speed current speed, give lastly rising id , speed every falling interval, 0 , speed other cases in inner query. select rows, have positive id
php mysql
Comments
Post a Comment