I am making a leaderboard for a game server and would like a hand with something.
I have a table in MySQL that looks like this (There are other columns that exist but I want to ignore)
Is there a way to combine each row with the same value in steam_id_64
, but with player_name
show the last used steam name (Or current from steam) and is it possible to hide the row where steam_id_64
is BOT
?
I have php5 if that is helpful. Thank you for the help.
使用!=
隐藏Steam_id_64为BOT的行
Select * from table where steam_id_64 !='BOT'
You have to sum up the different columns using sum() function. To avoid those bot entries you can use a condition to test for player_name is not BOT
select
player_name,
sum(kills) as kills,
sum(deaths) as deaths,
sum(assists) as assists,
sum(head_shots) as headshots,
sum(team_kills) as team_kills,
sum(assists_team_attack) as assist_team_attack,
sum(damage) as damage,
sum(hits) as hits,
sum(shots) as shots,
sum(last_alive) as last_alive
group by steam_id_64
where steam_id_64 != "BOT"
To make later handling convenient I have added "... as field_name" to each sum().
Please try this and refine your question if something is missing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.