logo       

Re: Select para feras 2: msg#00005

Subject: Re: Select para feras 2
Ola,
Em Fri, 6 Feb 2004 19:08:26 -0200
"Marcio Carvalho" <marciocar-y7mWNqJcIDpfJ/NunPodnw@xxxxxxxxxxxxxxxx> escreveu:

>  
> Desculpem, mandei o anterior incompleto,
> 
> 1)Possuo as tabelas com os campos decritos abaixo:
> 
> Produto                     MovimentoEstoque
> --------------------        ----------------------------
> prodCodigoID integer (PK)   estCodigoID integer (PK) 
> prodNome varchar(50)        estTipoMovimento integer 
> prodQuantidade integer      estQuantidade integer  
> prodValor numeric(5,2)      prodCodigoID integer (FK)
> 
> 
> - Onde estTipoMovimento tem o valor "0" para saída e "1" para entrada
> - Como posso fazer uma pesquisa que me retorne o total de entrada e daída de 
> um 
>  determinado produto?
> 

Não sou fera, mas na falta de outras respostas...

Você quer o total de entradas *e* saídas simultaneamente, ou:
entrada *ou* saída?
Se for entrada ou saída a solução abaixo de ajudar:

select sum(estQuantidade) from MovimentoEstoque where prodCodigoID=<produto> 
and estTipoMovimento=<tipo_mov>;

Se for entrada e saida complica, talvez tenha que usar subconsultas;


> 
> 2) Possuo as tabelas com os campos decritos abaixo:
> 
> Arquivo                    Processo                     ArquivoProcesso
> --------------------       ------------------------     
> ------------------------
> arqCodigoID integer (PK)   procCodigoID integer (PK)    arqCodigoID integer 
> (FK)
> arqNome varchar(50)        procNome varchar(15)         procCodigoID integer 
> (FK)
> 
> - Onde um Processo contem os seguintes campos registrados
> Processo
> ---------------------------
> arqCodigoID | procCodigoID
> - - - - - - - - - - - - - -
>           1             |    Criado 
>           2             |    Substituido
>           3             |    Removido
> 
> - Onde um Arquivo Pode sofrer mais de um processo
> - Como posso fazer uma pesquisa que me retorne o somente os arquivos
>  criados mas não substituídos ou removidos?
> 
> 

Tente:
select a.arqCodigoID, a.arqNome from Arquivo a, ArquivoProcesso aq where 
a.arqCodigoID=aq.arqCodigoID and aq.procCodigoID=1;


> 

-- 
johnny - LUN 157066 - johnny-H2hjhS7PiucJBBnbVQ8SfA@xxxxxxxxxxxxxxxx
Eu não posso, se você pode... doe sangue (por favor ;-) )!!!


mail do grupo 

Enviar mensagem: bancosdedados-EYaqaC9dFX8MqA7zqLjoiV/I71DsQ//L@xxxxxxxxxxxxxxxx
Assinar: 
bancosdedados-subscribe-EYaqaC9dFX8MqA7zqLjoiV/I71DsQ//L@xxxxxxxxxxxxxxxx
Cancelar assinatura: 
bancosdedados-unsubscribe-EYaqaC9dFX8MqA7zqLjoiV/I71DsQ//L@xxxxxxxxxxxxxxxx
Proprietário da lista: 
bancosdedados-owner-EYaqaC9dFX8MqA7zqLjoiV/I71DsQ//L@xxxxxxxxxxxxxxxx
 
Links do Yahoo! Grupos
Para visitar o site do seu grupo, acesse:
 http://br.groups.yahoo.com/group/bancosdedados/

Para sair deste grupo, envie um e-mail para:
 bancosdedados-unsubscribe-EYaqaC9dFX8MqA7zqLjoiV/I71DsQ//L@xxxxxxxxxxxxxxxx

O uso que você faz do Yahoo! Grupos está sujeito aos:
 http://br.yahoo.com/info/utos.html 




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    politics.lenini...    audio.emagic.ex...    tex.texinfo.gen...    handhelds.linux...    ietf.sipping/20...    lang.erlang.gen...    cygwin.talk/200...    yellowdog.gener...    mozilla.devel.l...    xfree86.newbie/...    openbsd.ports/2...    db.oracle.devel...    kde.kalyxo.deve...    user-groups.lin...    bbc.cvs/2003-04...    gnu.libtool.bug...    redhat.k12osn/2...    emulators.wine....    freebsd.devel.d...    search.xapian.g...    java.izpack.use...    network.mrtg.us...    windows.total-c...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe