MySQL Forums
Forum List  »  German

Re: Abfrage bei m:n Tabellen
Posted by: Markus Schatz
Date: April 18, 2010 04:15PM

Hallo Oliver,

das könntest du zum Beispiel mit Hilfe von Joins lösen:

SELECT produkte.id
FROM produkte
JOIN produkte_attribute ON produkte.id = produkte_attribute.prod_id
JOIN attribute ON produkte_attribute.attr_id = attribute.id
WHERE attribute.name = 'abc' AND attribute.wert = 'xyz'

So würdest du beispielsweise die IDs von allen Produkten erhalten dessen Attribut 'abc' den Wert 'xyz' hat.

Beste Grüße,

Markus Schatz
http://mschatz.com

Options: ReplyQuote


Subject
Views
Written By
Posted
3861
March 14, 2010 11:46AM
Re: Abfrage bei m:n Tabellen
1564
April 18, 2010 04:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.