For a list of players without duplicates an EXISTS
semi-join is probably best:
SELECT playerFirstName, playerLastName
FROM player AS p
WHERE EXISTS (
SELECT 1
FROM player2Statistic AS ps
WHERE ps.playerID = p.playerID
AND ps.StatisticID = 1
AND ps.p2sStatistic > 65
)
AND EXISTS (
SELECT 1
FROM player2Statistic AS ps
WHERE ps.playerID = p.playerID
AND ps.StatisticID = 3
AND ps.p2sStatistic > 295
);
Column names and context are derived from the provided screenshots. The query in the question does not quite cover it.
Note the parenthesis, they are needed to cope with operator precedence.
This is probably faster (duplicates are probably not possible):
SELECT p.playerFirstName, p.playerLastName
FROM player AS p
JOIN player2Statistic AS ps1 USING (playerID)
JOIN player2Statistic AS ps3 USING (playerID)
AND ps1.StatisticID = 1
AND ps1.p2sStatistic > 65
AND ps3.StatisticID = 3
AND ps3.p2sStatistic > 295;
If your top-secret brand of RDBMS does not support the SQL-standard (USING (playerID)
, substitute: ON ps1.playerID = p.playerID
to the same effect.
It's a case of relational division. Find many more query techniques to deal with it under this related question:
How to filter SQL results in a has-many-through relation