Micha Z: SQL - INNER JOIN über 4 Tabellen Problem

Beitrag lesen

Hallo,

ich bastle grad an einem kleinen XT-Shop rum und habe ein Problem mit einem SQL. Leider bin ich in SQL noch nicht fit, daher mal folgende Frage :
Ich habe 4 Tabellen

  • orders
  • orders_products
  • products_description
  • products

Nun möchte ich anhand einer Bestellnummer untere Informationen/Felder aus insgesamt 4 Tabellen mit folgendem SQL holen :
SELECT
orders.orders_id,
orders.orders_status,
orders_products.products_id,
products_description.products_name,
products.products_faq_id
FROM
 orders
INNER JOIN
 orders_products
ON
 orders_products.orders_id = orders.orders_id
INNER JOIN
 products_description
ON
 products_description.products_id = orders_products.products_id
INNER JOIN
 products
ON
 products.products_id = orders_products.products_id
WHERE
 orders.orders_id = 42

=============================================================================================
Obwohl die Bestellung "42" 2 Produkte beinhaltet (1 und 2), sieht die Ausgabe wie folgt aus :

orders_id = 42
orders_status = 3
products_id = 1
products_name =
products_faq_id = 0001

orders_id = 42
orders_status = 3
products_id = 1
products_name = Das tolle Produkt 1
products_faq_id = 0001

=============================================================================================
Erwartet hätte ich aber :

orders_id = 42
orders_status = 3
products_id = 1
products_name = Das tolle Produkt 1
products_faq_id = 0001

orders_id = 42
orders_status = 3
products_id = 2
products_name = Das tolle Produkt 2
products_faq_id = 0002

Offensichtlich hab ich das mit dem INNER JOIN noch nicht so recht verstanden. Hat jemand einen
Hinweis, oder gehe ich eine solche Abfrage sogar völlig falsch an?

Vielen Dank für Hilfe im Voraus
Gruß
MZ