Joining more than three tables with php and sql
Hi
I am familar with joining two tables but recently need to join three tables and find hard to do so.
This is my code:
$sqlconnect=mysql_query("SELECT Friends.frinum, Friends.userid, Friends.friendid, Experiences.expid, Experiences.userid, Experiences.title, Experiences.Dateofexpi, Experiences.description, Experiences.datetime
FROM Experiences INNER JOIN Friends ON Friends.userid=Friends.friendid
UNION
SELECT Users.id, Users.username, Users.profilepic, Friends.frinum, Friends.friendid, Friends.userid FROM Users INNER JOIN Friends ON Friends.userid='$id'");
I have tried to incorparate union which I am not familar with and run into problems when trying to the results.
The three tables are Users, Experiences and Friends.
Can any one help.
