Registriert seit: 9. Nov 2003
Ort: 04539 Groitzsch
1.351 Beiträge
Delphi 11 Alexandria
|
Re: mySQL-Abfrage - mehrfacher Join auf gleiche Tabelle?
19. Apr 2006, 15:52
Hi,
du musst in diesem Fall einen Tabellenalias benutzen:
SQL-Code:
SELECT pc.*,
n.Name as user_Name, n.Vorname as user_VName,
n.Organisation as user_org, n.Telefon as user_Tel, n.UserID as user_userid,
u.Username as verantw_Username,
p.Name as partner_Name, p.Vorname as partner_VName,
p.Organisation as partner_org, p.Telefon as partner_Tel, p.UserID as partner_userid
FROM PC_new pc LEFT JOIN Nutzer n ON pc.IDUser=n.id
LEFT JOIN User u ON pc.IDVerantw=u.resID
LEFT JOIN Nutzer p ON pc.IDPartner=p.id;
natürlich ungetestet...
Cu, Frank
Frank Reim
|
|
Zitat
|