1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | .headers off .mode list /* awkward and repetitive bc my sql is bad */ select 'New cards this round:'; with card as ( select round,player,card1 as card from deck union select round,player,card2 as card from deck union select round,player,card3 as card from deck), new as ( select min(card.round) as rnd, group_name = 'final' as isfinal, card from match join card on match.round = card.round and match.player = card.player group by 2,3 order by 1,2) select card from new where rnd = (select max(rnd) from new) and not isfinal; select ''; select 'Cards that made finals for the first time:'; with card as ( select round,player,card1 as card from deck union select round,player,card2 as card from deck union select round,player,card3 as card from deck), new as ( select min(card.round) as rnd, group_name = 'final' as isfinal, card from match join card on match.round = card.round and match.player = card.player group by 2,3 order by 1,2) select card from new where rnd = (select max(rnd) from new) and isfinal; select 'Data at https://data.3cardmagic.org' |