merged branch 'speed-records', squashed
This commit is contained in:
5
queries/fastest-player-of-map.sql
Normal file
5
queries/fastest-player-of-map.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
select speed, ifnull(alias, 'Unregistered Player')
|
||||
from Speed, Fastest_players
|
||||
left join Id2alias
|
||||
on idvalue = cryptokey
|
||||
where Speed.mapid = Fastest_players. mapid and Speed.mapid = ?
|
12
queries/fastest-players.sql
Normal file
12
queries/fastest-players.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
select Speed.mapid, max(trank), speed, ifnull(alias, 'Unregistered Player')
|
||||
from Speed, Fastest_players, Cts_times
|
||||
left join Id2alias
|
||||
on Fastest_players.idvalue = cryptokey
|
||||
where Speed.mapid = Fastest_players.mapid
|
||||
and Cts_times.mapid = Speed.mapid
|
||||
and tvalue != 0
|
||||
group by Cts_times.mapid
|
||||
order by count(trank) DESC;
|
||||
|
||||
-- if condition tvalue != 0 is not present
|
||||
-- database will return that maps have 99 records
|
@@ -22,6 +22,18 @@ CREATE TABLE Id2alias(
|
||||
alias TEXT,
|
||||
PRIMARY KEY (cryptokey)
|
||||
);
|
||||
drop table if exists Speed;
|
||||
create table Speed(
|
||||
mapid text,
|
||||
speed float,
|
||||
primary key (mapid)
|
||||
);
|
||||
drop table if exists Fastest_players;
|
||||
create table Fastest_players (
|
||||
mapid text,
|
||||
idvalue text,
|
||||
primary key (mapid)
|
||||
);
|
||||
|
||||
-- These table fields are unaltered.
|
||||
-- Exerpts from source/qcsrc/race.qc
|
||||
@@ -38,4 +50,4 @@ CREATE TABLE Id2alias(
|
||||
|
||||
-- re: foreign key from & to Cts_ranks & Id2alias.
|
||||
-- An ranked unregistered player will have a row in Cts_ranks, but will not have a row in Id2alias.
|
||||
-- A registered player may have a row in Id2alias, but may not necessary have a rank.
|
||||
-- A registered player may have a row in Id2alias, but may not necessary have a rank.
|
||||
|
Reference in New Issue
Block a user