BiggerBrother
Technical User
I have two tables. The first contains name and id number. The second contains ID1, ID2 and relationships.
I need to iterate through the second table to find when either ID1 or ID2 equal an ID. When this is true, the sataset reurned should contain the other persons ID, their name and their relationship. Confused? Here is my code.
"SELECT Name, Relationship, ID " _
& "FROM Table1, Table2 WHERE id=any
(SELECT ID1 FROM Relationship WHERE ID2 = 1)"
& "or id=any (SELECT ID2 FROM Relationship WHERE ID1 = 1)"
When i run this code, the relationships returned are correct, but the name reutrned is that of the first dataset row. What am i doing wrong? Any help would be fantastic.
BB
I need to iterate through the second table to find when either ID1 or ID2 equal an ID. When this is true, the sataset reurned should contain the other persons ID, their name and their relationship. Confused? Here is my code.
"SELECT Name, Relationship, ID " _
& "FROM Table1, Table2 WHERE id=any
(SELECT ID1 FROM Relationship WHERE ID2 = 1)"
& "or id=any (SELECT ID2 FROM Relationship WHERE ID1 = 1)"
When i run this code, the relationships returned are correct, but the name reutrned is that of the first dataset row. What am i doing wrong? Any help would be fantastic.
BB