Autor Beitrag
moloch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Di 22.01.08 09:42 
Hallo Leute,
kann mir jemand Helfen ich will 3 Tabellen mit einer SQL abfragen..

Also ich möchte aus Tab1 --> Wert1, Wert2
wenn Wert1 aus Tab1 auch in Tab2 vorhanden ist.
In Tab2 wiederrum ist eine ID vorhanden dessen Wert ich aus einer 3. Tabelle bekomme

Mein Versuch:

ausblenden SQL-Anweisung
1:
2:
3:
4:
SELECT     a.Wert1, a.Wert2, b.Wert1, b.Wert2 AS Expr1
FROM         Tab1 a INNER JOIN
                      Tab2 b ON a.Wert1 = b.Wert1
                    CROSS JOIN ZUKEY c


Moderiert von user profile iconChristian S.: SQL-Tags hinzugefügt
Genie
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 17

Win 95, 98, 2000, Millenium, XP, Linux, Unix

BeitragVerfasst: Di 22.01.08 10:20 
ausblenden SQL-Anweisung
1:
select a.Wert1, b.Wert, a.Wert2, b.Wert2 from Tab1 a, Tab2 b, Tab3 c where a.Wert1 = b.Wert1 and b.Wert1 = c.Wert1;					


Moderiert von user profile iconChristian S.: SQL-Tags hinzugefügt
zuma
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 660
Erhaltene Danke: 21

Win XP, Win7, Win 8
D7 Enterprise, Delphi XE, Interbase (5 - XE)
BeitragVerfasst: Di 22.01.08 12:02 
probiers mal so:

ausblenden SQL-Anweisung
1:
2:
3:
SELECT a.Wert1, a.Wert2, b.Wert1, b.Wert2 AS Expr1, c.id FROM Tab1 a 
INNER JOIN Tab2 b ON b.Wert1 = a.Wert1
Inner JOIN Tab3 c on c.id = b.id


Moderiert von user profile iconChristian S.: SQL-Tags hinzugefügt

_________________
Ich habe nichts gegen Fremde. Aber diese Fremden sind nicht von hier! (Methusalix)
Warum sich Sorgen ums Leben machen? Keiner überlebts!
moloch Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 451

Win 2000
D5 Prof
BeitragVerfasst: Di 22.01.08 12:54 
dank euch. ich hatte es schon hinbekommen. der letzte beitrag funktioniert auch.