Reputation:
I need your help.
This is my Products Table:
id name type
1 item 1 A
2 item 2 A
3 item 3 B
4 item 4 B
etc...
I want to search all possible records which start with item in Type A
I have this query:
SELECT * FROM products
WHERE type = 'A'
OR name LIKE '%item%';
But I'm getting possible records from other types. How can I filter to only display Type A? Any ideas?
Upvotes: 0
Views: 71
Reputation: 3620
use AND
instead of OR
SELECT * FROM products
WHERE type = 'A'
AND name LIKE 'item%';
Upvotes: 2