这将为您提供A和B胜过C,D和E的所有游戏路线。
select * from games where gameid in (select gameid from games where name in ('Anna A', 'Barley B') and winloss=1 group by gameid having count(*) = 2 intersect select gameid from games where name in ('Charly C', 'Dave D', 'Ed E') and winloss = 0 group by gameid having count(*) = 3) ;
或者,您可以使用:
select *from games where gameid in ( select gameid from games where name = 'Anna A' and winloss = 1 intersect select gameid from games where name = 'Barley B' and winloss = 1 intersect select gameid from games where name = 'Charly C' and winloss = 0 intersect select gameid from games where name = 'Dave D' and winloss = 0 intersect select gameid from games where name = 'Ed E' and winloss = 0 ) ;
最适合您的。
然后
sum,您可以添加和
group by以获得累积结果。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)