the following MySQL statement takes a very long time to execute, I think because I'm using gameId IN.
I think the most efficient way would be to use a INNER JOIN, but I'm new to MySQL and I can't come up with the INNER JOIN statement. Can you please help me out? If there is a more efficient way than INNER JOIN, I would like to use that, I'm just not sure if there is.
Statement that needs to be more efficient:
SELECT championId FROM match_up WHERE gameId IN ( SELECT gameId FROM match_up GROUP BY gameId HAVING SUM(championId IN (19, 23, 40) AND win = 1) = 3 AND SUM(championId IN (7, 18) AND win = 0) = 2 ) Thank you in advance for the help and knowledge!