Hallo,
table artikel
artikel_id bezeichnung
1 apfel
2 birne
3 schokoladetable preis
artikel_id preis
1 5.00 (das wäre der apfel)
2 2.00Nun möchte ich abfragen, bei welchen Artikel kein Preis vorhanden ist. Geht das?
SELECT artikel_id FROM artikel A, preis B WHERE A.artikel_id = B.artikel_id
Das ist ein INNER JOIN. Der enthält _nur_ die Datensätze, bei denen artikel_id gleich ist. Er enthält also schokolade _nicht_.
Du brauchst einen LEFT JOIN
SELECT artikel_id, bezeichnung FROM artikel LEFT JOIN preis ON artikel.artikel_id = preis.artikel_id WHERE preis.preis IS NULL
viele Grüße
Axel