Hey guys, I need to join three tables, but I have never done three and I can;t get it to work.
First let me show you the three tables
tblCustomers
CustomerID
AccountID
UserID
Name
etc..
tblUsers
UserID
AccountID
Username
etc..
tblJobs
JobID
AccountID
CustomerID
UserID
JobStatus
etc...
I need to get everything from the tblJobs, the Name from tblCustomers and Username from tblUsers all in one SQL statement if possible.
I have a SQL statement that joins 2 tables (tblJobs and tblCustomers) and works fine
$sql="SELECT c.Name, j.*
FROM tblJobs AS j
INNER JOIN tblCustomers AS c
USING(CustomerID)
WHERE j.AccountID = '$accountID'
AND j.DateAdded >= '$low'
AND j.DateAdded <= '$high'
ORDER BY j.$orderBy";
Now I want to add the third table tblUsers and get the Username from that.
Is this possible given the database design?
Thanks guys! Means a lot! 😕