Looking at this solution: MySql Join three tables
I see that I can join 3 tables by doing something like this:
select s.name "Student", c.name "Course"
from student s, bridge b, course c
where b.sid = s.sid and b.cid = c.cid
But it seems like I can only select a single column from each table? I need to join multiple colums from 3 tables with sys_visits being the main table where userID=contrID (sys_users, sys_visits) and clientID=clientID (sys_client, sys_visits)
SELECT pid, clientID, contrID, serviceDate, serviceStart, serviceStop FROM sys_visits
SELECT userGroupID, userID, fname, lname FROM sys_users
SELECT clientID, clientFName, clientLName FROM sys_client ORDER BY clientLName ASC
I’ve tried numerous variations and can’t seem to get the syntax correct?
use the
ANSI SQL-92format of join instead.the use of asterisks in the query indicates that you are selecting all columns from the tables. If you want to only choose specific columns, declare the column names explicitly on the query, example: