If OR
is only in Y, it needs parentheses, otherwise any y = 2
returns, regardless of the values of f
and h
.
Otherwise, you have to see if JOIN
is correct, it would be best not to use equal names in fields and tables.
Possible solution (correct tabela1.w
for the right field name):
SELECT x, y, z, f , g , h
FROM torrents AS tabela1
INNER JOIN w AS tabela2
ON tabela1.w = tabela2.x
WHERE ( y = '2' OR y = '7' )
AND f = '1'
AND h < 4294967296
If you want to make it a bit more elegant, you can use IN
and take the quotes:
SELECT x, y, z, f , g , h
FROM torrents
INNER JOIN w ON w = x
WHERE y IN ( 2, 7 )
AND f = 1
AND h < 4294967296