SHARE
TWEET

Untitled

a guest Oct 12th, 2017 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT emp.id, emp.first_name,
  2.   (SELECT COUNT(*) FROM customer AS c WHERE fk_employee = emp.id AND c.registration_date BETWEEN '2017-01-01' AND '2017-10-12') AS R1,
  3.   (SELECT COUNT(*) FROM service_data_report AS sdr WHERE employee_id = emp.id AND opening_date BETWEEN '2017-01-01' AND '2017-10-12') AS R2,
  4.   (SELECT COUNT(*) FROM service_data_report WHERE employee_id = emp.id AND closing_date BETWEEN '2017-01-01' AND '2017-10-12') AS R3 FROM employee AS emp WHERE emp.tenant_id = 1
RAW Paste Data
Top