Jump to content
Seja Membro VIP - Remova Banners de Propagandas, Tenha Liberado Qualquer Download, Além de Acessos em Áreas Exclusivas!! ×

Recommended Posts


  • Topic Count:  7
  • Topics Per Day:  0.02
  • Content Count:  14
  • Content Per Day:  0.04
  • Reputation:   3
  • Achievement Points:  113
  • Solved Content:  0
  • Days Won:  1
  • Status:  Offline
  • Age:  22
  • Device:  Windows

Posted

Olá, estou querendo trazer o valor do projeto separado pelos grupos de insumo do mesmo. Alguem sabe?

Tipo assim. Isso é um print de um BI que temos aqui, mas não sei como trazer essa informação no sistema, via SQL.

image.png.04f87a68b579a0b1d5c2b83309e641ba.png

  • Like 1

  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  518
  • Content Per Day:  0.19
  • Reputation:   164
  • Achievement Points:  3,451
  • Solved Content:  0
  • Days Won:  71
  • Status:  Offline
  • Age:  36
  • Device:  Android

Posted

@Luis Gustavo, meu xára, boa noite! 

Vai depender de qual tabela irá trabalhar, mas segue um exemplo


SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET NOCOUNT ON;

SELECT 
	 AP.CODCOLIGADA
	,AP.IDPRJ 
	,UPPER(G.DESCGIS) AS 'DESCRICAO_GRUPO'
	,SUM(AP.QUANTIDADE * AP.PRECOUNITARIO) AS 'TOTAL'
FROM DBO.MISMAPROP AP
JOIN DBO.MISM I ON (AP.CODCOLIGADA = I.CODCOLIGADA AND AP.IDPRJ = I.IDPRJ AND AP.IDISM = I.IDISM)
JOIN DBO.MGIS G ON (I.CODCOLIGADA = G.CODCOLIGADA AND I.IDPRJ = G.IDPRJ AND I.IDGIS = G.IDGIS )
WHERE AP.CODCOLIGADA = 1 
AND AP.IDPRJ = 10321
AND AP.DATAAPROPRIACAO >= '2025-03-14'
AND AP.DATAAPROPRIACAO <  '2025-04-01'
GROUP BY GROUPING SETS((AP.CODCOLIGADA,AP.IDPRJ,G.DESCGIS),())
OPTION (RECOMPILE, MAXDOP 1)

 

 

Abraços

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.