Jump to content
Sign in to follow this  
osiel73150

Cadastro De Produtos

Recommended Posts

Prezados,

Preciso de ajuda para criar um script que crie as tabelas do estoque minimo no sistema.

LECT DISTINCT

TPRD.NOMEFANTASIA,

TPRD.NUMNOFABRIC,

TPRD.IDPRD,

TPRDLOCINFO.SALDFISMIN,

TPRDLOCINFO.IDPRD

FROM TPRD LEFT OUTER JOIN TPRDLOCINFO ON TPRD.IDPRD = TPRDLOCINFO.IDPRD AND

TPRD.CODCOLIGADA = TPRDLOCINFO.CODCOLIGADA

WHERE TPRD.CODCOLIGADA = '1'

a consulta acima mostra todos os itens que não tem cadastro de estoque minimo. o que eu quero fazer é inserir a tabela tprdlocinfo apenas nos produtos relacionados na consulta acima.

Obrigado.

Share this post


Link to post
Share on other sites

bom seria algo mais ou menos assim:

INSERT INTO TPRDLOCINFO (CODCOLIGADA, IDPRD, CODLOC,SALDFISMIN,SALDOFISMAX)

SELECT TPRD.CODCOLIGADA, TPRD,IDPRD, [CODLOC] ,[sALDOMIN] ,[sALDOMAX]

FROM TPRD LEFT OUTER JOIN TPRDLOCINFO ON TPRD.IDPRD = TPRDLOCINFO.IDPRD AND

TPRD.CODCOLIGADA = TPRDLOCINFO.CODCOLIGADA

Os campos entre colchetes ( [CODLOC] ,[sALDOMIN] ,[sALDOMAX] ) deverão ser substituídos pelos valores correspondentes.

o meu concelho seria inserir 1 produto da forma tradicional, mapear os valores dessa inserção e reproduzi-la no insert.

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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