My First Table Name is UserClient
and it contains UserTrainerID
. Using UserTrainerID
, Second Table is UserTrainer
and it contains UserID
(I want to Know the UserID
of UserTrainer
using UserTrainerID
), now third table is User
where with the help of userID
I want to get the UserName
.
Asked
Active
Viewed 266 times
-1
2 Answers
0
Select a.username from t3 a,t2 b,t1 c
where a.userid=b.userid and b.UserTrainerID= c.UserTrainerID ;

Hardik Vinzava
- 968
- 10
- 22
-
1It is preferable, now, to put the join conditions in the `ON` clause rather than in the `WHERE` clause. – Michael Green Apr 26 '14 at 13:45
0
Here is syntax to join three tables, I hope you will be able to join your tables accordingly:
SELECT t1.col, t3.col FROM table1
join table2 ON table1.primarykey = table2.foreignkey
join table3 ON table2.primarykey = table3.foreignkey