Forum: Datenbanken
Delphi
by Grolle,
26. Mär 2010
Hallo,
zeigt mir auch die contact_id nicht an. So geht es:
SELECT g.id, g.parent, g.itemlevel, g.name, cg.contact_id
FROM groups g
LEFT JOIN contacts2groups cg
ON g.id = cg.group_id
AND cg.contact_id = 1
Forum: Datenbanken
Delphi
by Grolle,
25. Mär 2010
Hallo,
nein, ich muss ja noch einen bestimmten Kontakt haben (also ein where contacts2groups.contact_id=1 muss irgendwie noch rein). Angezeigt werden soll aber alles aus der Groups-Tabelle.
Viele Grüße ...
Forum: Datenbanken
Delphi
by Grolle,
25. Mär 2010
Hallo,
ich baue mit folgender Abfrage einen Baum auf:
SELECT * FROM groups ORDER BY itemlevel ASC, name ASC
jetzt möchte ich schauen, welche Kontakte welcher Gruppe zugeordnet sind. Ich brauche also alle Einträge von der Groups-Tabelle und brauche aus der contacts2groups die contact_id, wenn zugeordnet. Jetzt brauche ich nur noch einen Ansatz :roll: .
Tabellenstruktur groups: id, parent,...