Loading

try this one

  1. SELECT        CONCAT(time_recorder_users.user_first_name, ' ', time_recorder_users.user_last_name) AS first_last, time_recorder_jobs.start_time, time_recorder_jobs.end_time,
  2.                          TIMESTAMPDIFF(MINUTE, time_recorder_jobs.start_time, time_recorder_jobs.end_time) AS MinutesTaken
  3. FROM            time_recorder_jobs INNER JOIN
  4.                          time_recorder_users ON time_recorder_jobs.user_id = time_recorder_users.user_id INNER JOIN
  5.                          time_recorder_companies ON time_recorder_users.company_id = time_recorder_companies.company_id INNER JOIN
  6.                          time_recorder_operations ON time_recorder_jobs.operation_id = time_recorder_operations.operation_id INNER JOIN
  7.                          time_recorder_tasks ON time_recorder_jobs.task_id = time_recorder_tasks.task_id INNER JOIN
  8.                          time_recorder_customers ON time_recorder_jobs.customer_id = time_recorder_customers.customer_id INNER JOIN
  9.                          time_recorder_farms ON time_recorder_jobs.farm_id = time_recorder_farms.farm_id
  10. WHERE        (time_recorder_jobs.user_id = 6) AND (time_recorder_jobs.deleted = 0) AND (time_recorder_jobs.start_time >= '1/1/2014') AND
  11.                          (time_recorder_jobs.end_time <= '8/19/2014 11:59:59 PM') AND (time_recorder_jobs.user_id = 6) AND (time_recorder_users.company_id = 2) AND
  12.                          (time_recorder_tasks.is_zero_minutes_task = 0)
  13. ORDER BY time_recorder_jobs.end_time DESC

Comments