Created
August 19, 2019 23:13
-
-
Save raphaeldealmeida/b765d2c0c78982f28baedc71f1dff0d6 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 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