SHARE
TWEET

Untitled

a guest Jul 15th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT COUNT(id) FROM `agendas` WHERE funcionario_id = agendas.funcionario_id GROUP BY date_format(inicio, '%Y-%m-%d'), funcionario_id limit 1
  2.      
  3. SELECT
  4.     distinct
  5.     (SELECT COUNT(id) FROM `agendas` WHERE funcionario_id = agendas.funcionario_id GROUP BY date_format(inicio, '%Y-%m-%d'), funcionario_id limit 1) as dia,
  6.     (SELECT COUNT(id) FROM `agendas` WHERE  funcionario_id = agendas.funcionario_id and inicio BETWEEN DATE_ADD(now(), INTERVAL(1 - DAYOFWEEK(now())) DAY)  AND DATE_ADD(now(), INTERVAL(3 + DAYOFWEEK(now())) DAY) GROUP BY date_format(inicio, '%u') limit 1) as semana,
  7.     (SELECT COUNT(id) FROM `agendas` WHERE funcionario_id = agendas.funcionario_id GROUP BY date_format(inicio, '%Y-%m'), funcionario_id limit 1) as mes,
  8.     (SELECT COUNT(id) FROM `agendas` WHERE funcionario_id = agendas.funcionario_id GROUP BY date_format(inicio, '%Y'), funcionario_id limit 1) as ano,
  9.     (select users.name from users,funcionarios where funcionarios.id = agendas.funcionario_id and users.id = funcionarios.user_id) as nome
  10. from
  11.     agendas
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top