|
jorge -> RE: Whats wrong with my query (9/17/2003 18:20:09)
|
Actually the query uses only 1 table(Duiven), look: Don't forget that i created this query in access SELECT Duiven.Rin, Duiven.Vad, Duiven.Moe, Duiven_1.Vad, Duiven_1.Moe, Duiven_2.Vad, Duiven_2.Moe FROM (Duiven LEFT JOIN Duiven AS Duiven_1 ON Duiven.Vad=Duiven_1.Rin) LEFT JOIN Duiven AS Duiven_2 ON Duiven.Moe=Duiven_2.Rin; I used 3 copy's of the same table(Duiven), access automaticly calls them Duiven, Duiven_1, Duiven_2. I posted this question on some other forums, and now i think i know the cause of the problem: ****************************************************************************************************** ****************************************************************************************************** ...it has to do with just standard SQL coding and ADO. You *MUST* use aliases for the duplicated field names. Because outside of Access, only the field name is visible, *not* the table name: SELECT Duiven_0.Rin AS D0Rin, Duiven_1.Rin AS D1Rin, Duiven_2.Rin AS D2Rin, Duiven_1.Vad AS D1Vad, Duiven_1.Moe AS D1Moe, Duiven_2.Vad AS D2Vad, Duiven_2.Moe AS D2Moe FROM (Duiven AS Duiven_0 LEFT JOIN Duiven AS Duiven_2 ON Duiven.Moe = Duiven_2.Rin) LEFT JOIN Duiven AS Duiven_1 ON Duiven.Vad = Duiven_1.Rin; And then you use the field names D0Rin, D1Rin, etc., to get the data from those fields. ****************************************************************************************************** ****************************************************************************************************** You see, whats important here is =====> Because outside of Access, only the field name is visible, *not* the table name. I'm gonna try this out now, i have a good feeling about this.
|
|
|
|