How can I correctly perform the following query?
SELECT * FROM tabla WHERE id = `1` AND categoria = `php` OR categoria = `js`
I want to be selected:
- all records whose ID is equal to 1,
- and whose category is "php" or "js".
How can I correctly perform the following query?
SELECT * FROM tabla WHERE id = `1` AND categoria = `php` OR categoria = `js`
I want to be selected:
The correct way to do it would be using a parenthesis after the
AND
, that is:It is important to be careful with quotes, in this case with single quotes
''
.