Select a.username from t3 a,t2 b,t1 c
where a.userid=b.userid and b.UserTrainerID= c.UserTrainerID ;
Joing the Tables to get the required data, I got three tables which are connected and i want to get the data from the 3rd table
-
09-07-2023 - |
Question
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
.
Solution
OTHER TIPS
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow