sql >> Base de Datos >  >> RDS >> Mysql

cómo crear esta consulta

Usar:

  SELECT p.playername,
         SUM(CASE WHEN g.result = 'first' THEN 1 ELSE 0 END),
         COUNT(*)
    FROM PLAYER p
    JOIN GAME g ON g.playerid = p.playerid
GROUP BY p.playername