statistics/mysql.R

24 lines
410 B
R
Raw Normal View History

2022-09-02 17:06:02 -04:00
library(RMySQL)
2022-09-03 18:54:56 -04:00
conn <- dbConnect(
2022-09-02 17:06:02 -04:00
MySQL(),
user = dbuser,
password = dbpass,
dbname = dbname,
host = dbhost,
port = dbport
)
2022-09-03 18:54:56 -04:00
2022-09-03 19:01:20 -04:00
query_frames <- "
2022-09-03 18:54:56 -04:00
SELECT
f.coins, CAST((f.elapsed_time / 1000) AS INT)
FROM game g
LEFT JOIN frame f ON (f.game_id = g.id)
WHERE (
f.id = (
SELECT id FROM frame WHERE game_id = g.id ORDER BY elapsed_time DESC LIMIT 1
)
)
GROUP BY g.id;
"