Jump to content
Fórum Script Brasil
  • 0

somar dados na tabela comum nvl no select


rodrigo chisi

Question

Boa tarde , estou tendo dificuldades  pra fazer uma soma com um nvl no select , segue abaixo o sql , eu quero fazer a soma de quantidade de peças de roupas que deram saída por setor.

 


SELECT estoque. ds_estoque  setor_saindo,
    det_saida . qt_quantidade qt_quantidade,
      NVL(kit . ds_kit, tp_pecas . ds_tp_pecas) Descricao,   
       setor.nm_setor nome_setor, 
       cab_saida . dt_inc_usuario dt_saida, 
          usuarios . nm_usuario nm_usuario
     FROM dbamv  . cab_saida,
       dbamv  . det_saida,
       dbamv  . tp_pecas,
       dbamv  . kit,
       dbamv  . estoque,
       dbasgu . usuarios,
       dbamv  . setor,
       dbamv  . unid_int
 WHERE cab_saida.cd_seq_saida = det_saida.cd_seq_saida
   AND cab_saida.cd_estoque = estoque.cd_estoque(+)
   AND det_saida.cd_tp_pecas = Tp_Pecas.cd_tp_pecas(+)
   AND det_saida.cd_comp_kit = kit.cd_comp_kit(+)
   AND cab_saida.cd_setor = setor.cd_setor(+)
   AND cab_saida.cd_unid_int = unid_int.cd_unid_int(+)
   AND usuarios.cd_usuario =
       NVL(cab_saida.cd_usuario_alt, cab_saida.cd_usuario_inc)
 ORDER BY 5  ASC

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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

Guest
Answer this question...

×   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.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...