Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 15 lines (13 sloc) 0.496 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
CREATE OR REPLACE VIEW distinct_combos
AS SELECT DISTINCT charabbrev FROM logrecord;

CREATE OR REPLACE VIEW unwon_combos
AS SELECT dc.charabbrev FROM distinct_combos dc
WHERE NOT EXISTS (SELECT * FROM logrecord lr WHERE
                  lr.charabbrev = dc.charabbrev
                  AND ktyp = 'winning');

SELECT lr.charabbrev combo, COUNT(*) games
FROM logrecord lr, unwon_combos uw
WHERE lr.charabbrev = uw.charabbrev
  AND lr.ktyp != 'quitting'
GROUP BY lr.charabbrev
ORDER BY games DESC;
Something went wrong with that request. Please try again.