Created
August 19, 2019 23:13
-
-
Save raphaeldealmeida/1dd7a47e3201d9c728bdd1818e5e858f to your computer and use it in GitHub Desktop.
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
select avg(valor) previsao_valor from ( | |
SELECT TOP (1000) avg(VALOR) valor | |
FROM [onboard].[dbo].[RESUMO] | |
where (EMPRESA_ID = 1) | |
and (VALOR > 0) | |
and (DAY_WEEK = 1) | |
UNION | |
SELECT TOP (1000) avg(VALOR) valor | |
FROM [onboard].[dbo].[RESUMO] | |
where (EMPRESA_ID = 1) | |
and (VALOR > 0) | |
and (DAY_WEEK = 1) | |
and (ORDEM_SEMANA = 1) | |
UNION | |
SELECT TOP (1000) avg(VALOR) valor | |
FROM [onboard].[dbo].[RESUMO] | |
where (EMPRESA_ID = 1) | |
and (VALOR > 0) | |
and (DAY_WEEK = 1) | |
and (MES = 1) | |
) as medias |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment