Hey guys I have three tables, tblJobs and tblCustomers and tblUsers.
The tblJobs looks like this
JobID->Primary
CustomerID->Foriegn
UserID->Foriegn
RONumber
EstimateAmount
DateAdded
etc...
The tblCustomers looks like this
CustomerID->Primary
CustomerName
Street
City
DateAdded
etc...
The tblUsers looks like this
UserID->Primary
WriterName
etc...
Now, what I am trying to do is have a list of jobs that are selected between two dates and the list should display
RONumber, CustomerName, WriterName, JobID
My problem is getting the Customer Name and WriterName. I have the CustomerID in the Jobs table, but I cant figure out how to get the CustomerName from the Customer table and the WriterName from the Users table with the UserID as a result in the query.
I tried doing something like this
$sql="SELECT c.CustomerName, u.WriterName,j.*
FROM tblJobs AS j
INNER JOIN tblCustomers AS c,tblUsers AS u
USING(c.CustomerID,u.UserID)
WHERE j.AccountID = '$accountID'
AND JobStatus = 'Active'";
But that doesn't work right (errors out).
Any Help is much appreciated!