Contagem pós-docs #591#592
Merged
leandroramos merged 3 commits intouspdev:masterfrom Dec 2, 2025
Merged
Conversation
Member
Author
|
A saída trabalhada em gráficos está aqui: https://igc.usp.br/cpq/pesquisador-de-pos-doutorado/ |
leandroramos
approved these changes
Dec 2, 2025
Contributor
There was a problem hiding this comment.
Vou colocar a query que funcionou nos dois SGBDs aqui. São poucas diferenças, mas eu também coloquei um "IN" no código da unidade. Eu não tenho nem vontade de saber por que o Sybase não suporta o estilo 120 na conversão da data.
SELECT
CONVERT(CHAR(7),
DATEADD(month, -n.Num,
DATEADD(day, 1 - CONVERT(INT, DAY(GETDATE())), GETDATE())
), 102) AS AnoMes,
DATENAME(month,
DATEADD(month, -n.Num,
DATEADD(day, 1 - CONVERT(INT, DAY(GETDATE())), GETDATE())
)
) AS NomeMes,
YEAR(
DATEADD(month, -n.Num,
DATEADD(day, 1 - CONVERT(INT, DAY(GETDATE())), GETDATE())
)
) AS Ano,
COUNT(p.codprj) AS qtdProjetosAtivos
FROM (
SELECT 0 AS Num
UNION ALL SELECT 1
UNION ALL SELECT 2
UNION ALL SELECT 3
UNION ALL SELECT 4
UNION ALL SELECT 5
UNION ALL SELECT 6
UNION ALL SELECT 7
UNION ALL SELECT 8
UNION ALL SELECT 9
UNION ALL SELECT 10
UNION ALL SELECT 11
) n
LEFT JOIN PDPROJETO p
ON p.codund IN (__codundclg__)
AND p.staatlprj IN ('Aprovado', 'Ativo')
AND p.dtainiprj <= DATEADD(
day,
-CONVERT(INT, DAY(
DATEADD(month, -n.Num, GETDATE())
)) + 1,
DATEADD(month, -n.Num + 1, GETDATE())
)
AND (
p.dtafimprj IS NULL OR
p.dtafimprj >= DATEADD(
day,
1 - CONVERT(INT, DAY(GETDATE())),
DATEADD(month, -n.Num, GETDATE())
)
)
GROUP BY
CONVERT(CHAR(7),
DATEADD(month, -n.Num,
DATEADD(day, 1 - CONVERT(INT, DAY(GETDATE())), GETDATE())
), 102),
DATENAME(month,
DATEADD(month, -n.Num,
DATEADD(day, 1 - CONVERT(INT, DAY(GETDATE())), GETDATE())
)
),
YEAR(
DATEADD(month, -n.Num,
DATEADD(day, 1 - CONVERT(INT, DAY(GETDATE())), GETDATE())
)
)
ORDER BY Ano, AnoMes;| * @return array | ||
| */ | ||
|
|
||
| public static function contarPDporUltimos12Meses($statuses = ['Ativo','Aprovado']) |
Contributor
There was a problem hiding this comment.
Temos que ver onde vai o(s) dódigo(s) da(s) unidade(s) aqui.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.