Last active
December 23, 2016 12:07
-
-
Save marylly/669528cbee950417d890052b14c398c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
projects.name, | |
CONCAT((CASE t.tmonth | |
WHEN 1 THEN 'Janeiro' | |
WHEN 2 THEN 'Fevereiro' | |
WHEN 3 THEN 'Março' | |
WHEN 4 THEN 'Abril' | |
WHEN 5 THEN 'Maio' | |
WHEN 6 THEN 'Junho' | |
WHEN 7 THEN 'Julho' | |
WHEN 8 THEN 'Agosto' | |
WHEN 9 THEN 'Setembro' | |
WHEN 10 THEN 'Outubro' | |
WHEN 11 THEN 'Novembro' | |
WHEN 12 THEN 'Dezembro' | |
ELSE NULL | |
END) , '/', t.tyear) AS periodo, | |
ROUND(SUM(t.hours),2) as horas_trabalhadas FROM `projects` INNER JOIN | |
time_entries t ON projects.id = t.project_id | |
WHERE | |
t.tyear = 2016 AND | |
t.tmonth IN (10,11,12) | |
GROUP BY | |
projects.id, | |
projects.name, | |
periodo | |
ORDER BY | |
t.tyear, | |
t.tmonth, | |
projects.id, | |
projects.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment