MySQL Query Question
i have three tables
empId int pk
empid int pk fk
custid int pk fk
startdate date pk
custid int pk
my question is
How to show the name of all our employees with the customer name of those who are on customer sites today. For those who are not, show 'N/A' for the name and address.
i have so far
e.EmpId = ea.EmpId
cs.CustId = ea.CustId
which give me all employee at work today, with their name and the site.
any help you be very appreciated thanks
Re: MySQL Query Question
Your query and table definitions don't match.
EmployeeAssignment does not have an empId.
Anyway, assuming that's just a typo, you want to use outer joins.
Inner join the EA and CS tables together, then OUTER JOIN the employee table.
You'll then need to dig into the MySQL docs to find how you can do DECODE or CASE statements to turn the NULLs into 'N/A'.