Thema: Delphi SQL-Problem mal wieder

Einzelnen Beitrag anzeigen

Grolle

Registriert seit: 5. Nov 2004
Ort: Coesfeld
1.268 Beiträge
 
Delphi 2010 Professional
 
#1

SQL-Problem mal wieder

  Alt 18. Mai 2009, 19:54
Datenbank: Firebird • Version: 2.1 • Zugriff über: IBDAC
Hallo,
ich habe mal wieder ein kleines Problem mit einer Abfrage:

SQL-Code:
SELECT tree.id, tree.name, tree2contact.contact_id FROM tree left join
tree2contact on tree.id = tree2contact.tree_id where tree2contact.contact_id=22
Die Tabellen sehen so aus:
SQL-Code:
Tree
---------
id
name
parent

tree2contact
---------
id
tree_id
contact_id
Ich will jetzt alle tree.name die tree.parent=0 ohne Dubletten(tree.name) und tree2contact.contact_id=22 (oder 0 wenn nicht zugeordnet).

Viele Grüße ...

  Mit Zitat antworten Zitat