Abfrage über zwei Tabellen

Hallo,

das mit dem Left Join ist ja auch ok.

HuRaHoRRe hat gesagt.:
Nur weis ich jetzt gerade nicht wie du das genau auslesen kannst, da branche ja jetzt 3 verschiedene Werte hat.
Das meine ich ja mit
Bernd1984 hat gesagt.:
Du musst 3x auf die Branche joinen.
So meinte ich es: ;)
Code:
SELECT fname, bid1, $tab_branchen_1.branche AS branche1,
$tab_branchen_2.branche AS branche2, 
$tab_branchen_3.branche AS branche3 
FROM $tab_firmen 
LEFT JOIN $tab_branchen $tab_branchen_1 ON ($tab_firmen.bid1 = $tab_branchen_1.id) 
LEFT JOIN $tab_branchen $tab_branchen_2 ON ($tab_firmen.bid2 = $tab_branchen_2.id) 
LEFT JOIN $tab_branchen $tab_branchen_3 ON ($tab_firmen.bid3 = $tab_branchen_3.id)
 
Ah ok, so wollte ichs eigentlich auch machen nur hat das mit dem AND halt schlussendlich doch nicht gepasst^^

Bin grad nicht mehr auf dem aktuellsten Stand :S

:rolleyes:
 

Neue Beiträge

Zurück