So, I have this SQL schema that I cannot change and I am trying to pull data out and into a Google Sheet using a GAS Script. It returns 0 results. If I remove the last JOIN and the last (corresponding) line of SELECT columns I get 507 results. I know this has something to do with referencing a table that is not directly related to the primary table in the FROM clause. It is one step removed.
I would appreciated a little education here ...
:-)
PS: No I did not write/design/name the schema/tables/columns, and unfortunately I do not have access to modify anything ... just read.
SELECT table_tasktime.tasktime_employee, table_tasktime.tasktime_task,
table_tasktime.tasktime_start, table_tasktime.tasktime_end,
table_taskgroups.taskgroup_task, table_taskgroups.taskgroup_group,
table_employees.employee_id, table_employees.employee_firstname,
table_employees.employee_lastname, table_tasks.task_name,
table_groups.group_id, table_groups.group_name
FROM table_tasktime
INNER JOIN table_taskgroups
ON table_taskgroups.taskgroup_task = table_tasktime.tasktime_task
INNER JOIN table_employees
ON table_employees.employee_id = table_tasktime.tasktime_employee
INNER JOIN table_tasks
ON table_tasks.task_id = table_tasktime.tasktime_task
INNER JOIN table_groups
ON table_groups.group_id = table_taskgroups.taskgroup_id
WHERE (table_tasktime.tasktime_start BETWEEN '2016-01-01' AND '2016-01-25 23:59:59')