I am trying to write a mysql query that will list all employees, their job function, and the total costs of all jobs they did for a particular day. Here is the relevant portion of my tables:
job_function table
emp_func
emp_num
employee table
emp_name
emp_num
job table
job_date
emp_num
job_name
job_type table
cost
job_name
The query works except that it is only returns the employees that had a job for that particular day. If an employee had no job that day they do not show up. I need to to display all employees, even those that had no job that day. Any suggestions on how to do that? Here is my query:
SELECT
employee.emp_name,
job_function,emp_func,
SUM(job_type.cost)
FROM
employee
INNER JOIN job ON job.emp_num = employee.emp_num
INNER JOIN job_function ON job_function.emp_num = employee.emp_num
INNER JOIN job_type ON job.job_name = job_type.job_name
where job_date = '2016-04-16'
group by emp_name;