Inner Join for three tables?
Hi guys!
For two tables is working fine but for three tables i don't now how to do it?
Here is my Select statemebt for two tables:
Code:
Dim strsql2 = "SELECT employe.*,location.* FROM employe INNER JOIN location ON employe.ID_employe = location.ID_employe WHERE employe.ID_employe = " & Form3.manipulatedRow & " "
The third table that i wan't to add it is "job" that is also in relation with table employe.
Please help me with my problem!
Re: Inner Join for three tables?
You can use parenthesis:
Code:
Dim strsql2 = "SELECT employe.*, location.*, job.*
FROM
(employe INNER JOIN location
ON employe.ID_employe = location.ID_employe)
INNER JOIN job
ON employe.ID_employe = job.ID_employe
WHERE employe.ID_employe = " & Form3.manipulatedRow & " "
Or you can use the old method, preferred by many programmers, including myself:
Code:
Dim strsql2 = "SELECT employe.*, location.*, job.*
FROM employe, location, job
WHERE employe.ID_employe = location.ID_employe
AND employe.ID_employe = job.ID_employe
AND employe.ID_employe = " & Form3.manipulatedRow & " "