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:  11
  • Topics Per Day:  0.00
  • Content Count:  27
  • Content Per Day:  0.00
  • Reputation:   0
  • Achievement Points:  250
  • Solved Content:  0
  • Days Won:  0
  • Status:  Offline
  • Age:  55
  • Device:  Windows

Posted

Boa tarde.

Tenho um cubo, que busca informações da FLAN e da TMOV.
Até ai ok.
 
Os lançamentos são feitos no NUCLEUS (TMOV) gerando financeiro e está funcionando ok.
Porém foram inseridos lançamentos direto no FLUXUS (FLAN).
Até ai ok.
 
Porém agora, me pediram para buscar o TRANSPORTADOR (TTRA) dos movimentos do NUCLEUS (TMOV)
 
O que acontece é que quando coloquei a subquery buscando o TRANSPORTADOR (TTRA), somente me retorna os lançamentos originados do NUCLEUS.
Os lançamentos que foram incluídos no FLUXUS não aparecem.
 
Não se assuste com o modo arcaico da sentença...
 
Veja se consegue me dar um caminho.
 
Obrigado,
 
 
SELECT
FLAN.VALORORIGINAL - FLAN.VALORBAIXADO AS VALOR,
FCFO.NOME,
FLAN.DATAVENCIMENTO,
FLAN.NUMERODOCUMENTO,
FLAN.CODTB2FLX AS PORTADOR,
FLAN.DATAPREVBAIXA AS PREV_BAIXA,
ISNULL(FLAN.HISTORICO, '')AS HISTORICO,
ISNULL(FDADOSPGTO.NUMEROBANCO, ''),
ISNULL(FDADOSPGTO.CODIGOAGENCIA, ''),
ISNULL(FDADOSPGTO.DIGITOAGENCIA, ''),
ISNULL(FDADOSPGTO.CONTACORRENTE, ''),
ISNULL(FDADOSPGTO.DIGITOCONTA, ''),
ISNULL(FDADOSPGTO.CGCFAVORECIDO, ''),
FCFO.CIDADE AS CIDADE,
 
         (SELECT DISTINCT ISNULL (T1.NOME, 0) FROM TMOV, TTRA T1 WHERE T1.CODCOLIGADA = TMOV.CODCOLIGADA
                                    AND  T1.CODTRA = TMOV.CODTRA) AS TRANSPORTADOR
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic


  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  827
  • Content Per Day:  0.15
  • Reputation:   111
  • Achievement Points:  4,834
  • Solved Content:  0
  • Days Won:  76
  • Status:  Offline
  • Age:  62
  • Device:  Windows

Posted

Boa tarde,

Nos relacionamentos das tabelas experimenta usar left, right, inner, ...  join

http://www.devmedia.com.br/clausulas-inner-join-left-join-e-right-join-no-sql-server/18930

Veja o exemplo abaixo:

FROM   FLAN(NOLOCK)
       LEFT JOIN FLANRATDEP(NOLOCK)
         ON ( FLAN.IDLAN = FLANRATDEP.IDLAN )
            AND ( FLAN.CODCOLIGADA = FLANRATDEP.CODCOLIGADA )
       INNER JOIN FCFO(NOLOCK)
         ON ( FLAN.CODCFO = FCFO.CODCFO )
            AND ( FLAN.CODCOLCFO = FCFO.CODCOLIGADA )
       LEFT JOIN GDEPTO(NOLOCK)
         ON ( FLAN.CODCOLIGADA = GDEPTO.CODCOLIGADA )
            AND ( FLANRATDEP.CODDEPARTAMENTO = GDEPTO.CODDEPARTAMENTO )
            AND FLANRATDEP.CODFILIAL = GDEPTO.CODFILIAL
       INNER JOIN GCCUSTO (NOLOCK)
         ON GCCUSTO.CODCOLIGADA = FLAN.CODCOLIGADA
            AND GCCUSTO.CODCCUSTO = FLAN.CODCCUSTO


  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  1,140
  • Content Per Day:  0.20
  • Reputation:   60
  • Achievement Points:  6,165
  • Solved Content:  0
  • Days Won:  33
  • Status:  Offline
  • Age:  43
  • Device:  Windows

Posted

Consegue colocar a consulta completa ?

[]'s

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.