Here's a problem that I've been wrestling with and googling for about 12 hours now. I hope I can explain myself adequately.
I have two tables set up like this:
| product_name | brand_name |
| product a | company x |
| product b | company y |
| product_name | tag |
| product a | feature 1 |
| product a | feature 2 |
| product b | feature 2 |
So table 'tags' contains features about the products while 'products' contains other information on the products. Unfortunately I can't have the two in one table.
What I'm struggling with is making an SQL call which says something like:
"join the tables and show all products which have feature 1 and feature 2"
Here's what I've been trying:
SELECT tags.product_name, brand_name, tag
FROM products JOIN tags
ON products.product_name = tags.product_name
WHERE tag = 'feature a' AND tag = 'feature b'
ORDER BY product_name ASC
The problem I have is I can't find how to choose TWO columns from the tags table.
I hope I've explained my problem and thank you for any help you can give a tired coder.