Joining three tables
-
Hello everybody! I have three tables, namely t1, t2, t3
Dim cmdText As String
cmdText = "SELECT t1.StaffName, t2.CampusName
FROM t1
INNER JOIN t2
ON t1.CampusID = t2.CampusID
ORDER BY t1.StaffName"It is working fine. My problems starts when I want to include t3; such that;
t1.StaffID = t3.StaffID
I don't know; how to get it done. Please note that; StaffID is the Primary Key of t1 and the Secondary Key of t3. Would anyone help me, please!
-
Hello everybody! I have three tables, namely t1, t2, t3
Dim cmdText As String
cmdText = "SELECT t1.StaffName, t2.CampusName
FROM t1
INNER JOIN t2
ON t1.CampusID = t2.CampusID
ORDER BY t1.StaffName"It is working fine. My problems starts when I want to include t3; such that;
t1.StaffID = t3.StaffID
I don't know; how to get it done. Please note that; StaffID is the Primary Key of t1 and the Secondary Key of t3. Would anyone help me, please!
-
Hello everybody! I have three tables, namely t1, t2, t3
Dim cmdText As String
cmdText = "SELECT t1.StaffName, t2.CampusName
FROM t1
INNER JOIN t2
ON t1.CampusID = t2.CampusID
ORDER BY t1.StaffName"It is working fine. My problems starts when I want to include t3; such that;
t1.StaffID = t3.StaffID
I don't know; how to get it done. Please note that; StaffID is the Primary Key of t1 and the Secondary Key of t3. Would anyone help me, please!
Are you just looking for the syntax to join another table?
SELECT
...
FROM
t1
INNER JOIN t2
ON t2.CampusID = t1.CampusID
INNER JOIN t3
ON t3.StaffID = t1.StaffID
ORDER BY
...
;
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Are you just looking for the syntax to join another table?
SELECT
...
FROM
t1
INNER JOIN t2
ON t2.CampusID = t1.CampusID
INNER JOIN t3
ON t3.StaffID = t1.StaffID
ORDER BY
...
;
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Thank you very much, Richard Deeming, for the help. Have a very good day.