Skip to content

Instantly share code, notes, and snippets.

@matthew-brett
Created February 14, 2020 11:41
Show Gist options
  • Save matthew-brett/21ccfb02a2cf58c67e24ad1af373ab8f to your computer and use it in GitHub Desktop.
Save matthew-brett/21ccfb02a2cf58c67e24ad1af373ab8f to your computer and use it in GitHub Desktop.
/* Inspired by
https://www.mysqltutorial.org/mysql-subquery/
*/
DROP TABLE IF EXISTS stids;
CREATE TABLE stids SELECT steamid FROM (
SELECT DISTINCT steamid FROM Games_1) AS stids
WHERE rand() < 0.1;
SELECT steamid, appid, playtime_forever FROM Games_1
WHERE steamid in (SELECT steamid FROM stids)
INTO OUTFILE '/Volumes/rebrought/data/Games_1_stid_sample.csv'
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment