Hello,
I have table with articles
Articles:
ID | Name | category_id
and other table with article attributes:
Attributes:
ID | Attribute | article_id
Result:
What i need is to select all articles WHERE category_id=‘5’ AND Attribute=‘1024x768’
Can anyone please help me with this?! Thank you!!
Try this
SELECT art.id FROM articles art
LEFT JOIN attributes attr on attr.article_id = art.id
WHERE art.category_id='5' AND attr.Attribute='1024x768'
r937
3
SELECT articles.ID
, articles.Name
FROM articles
INNER
JOIN attributes
ON attributes.article_id = articles.ID
AND attributes.Attribute = '1024x768'
WHERE articles.category_id = 5
philip, your LEFT OUTER JOIN will behave exactly like an inner join because you have a non-NULL condition in the WHERE clause
Thank you much! I have tryed this and it works i need now to test more but i think this is what i need. Thank you!!!