If the OR
is only in the Y, needs parentheses, if any y = 2
returns, regardless of the values of f
and h
.
Other than that, you have to see if JOIN
is correct, it would be better not to use equal names in fields and tables.
Possible solution (correct the tabela1.w
for the name of the right field):
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 little more elegant, you can use IN
and remove the quotation marks:
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
Columns Y and F are INT or VARCHAR? Put the table structure there.
– Paulo Ricardo
Already managed to solve , thanks for trying to help!
– reigelado