USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Fórum

  Visual Basic
Voltar
Autor Assunto:  Agrupamento!
moncerra
SÃO PAULO
SP - BRASIL
ENUNCIADA !
Postada em 12/12/2008 10:38 hs         

Pessoal como faço este agrupamento.

tenho os seguintes dados:

PERIODO     REFPERIDO   NOME MEDICO   CRM     QTDCOMPRA    QTDRECOMPRA   TOT FAMILIA
S1  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546    0    1          1   FORASEQ
S1  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546    0    2          2   FORASEQ
S1  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546   0    5          5   FORASEQ
S1  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546    1    3                4   FORASEQ
S1  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546    1    4                5   FORASEQ

S2  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546    0    1                1   SEQ
S2  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546    0    2                2   SEQ
S2  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546    0    5                5   SEQ
S2  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546   1    3                4   SEQ
S2  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546          1    4                5   SEQ


Gostaria de agrupar da seguinte forma:

PERIODO     REFPERIDO   NOME MEDICO   CRM     QTDCOMPRA    QTDRECOMPRA   TOT FAMILIA
S1  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546    0    1          1   FORASEQ

S2  Jan/2008 - Jun/2008 1    ABIB MADAUN NETO    245546    0    1                1   SEQ

Não duplica-se as linhas.
Gostaria de agrupar por familia e PERIODO ?
Acredito que tenho fazer um SUM e agrupar  ?

   
Treze
Pontos: 2843 Pontos: 2843
SÃO VICENTE
SP - BRASIL
Postada em 12/12/2008 12:13 hs            

  SELECT DISTINCT(periodo referido,crm) from tabela

assim já não resolveria, no caso colocaria sem duplicar o periodo e ocrm do medico, exibindo um resultado parecido com o que desja

     
Página(s): 1/1    


Seu Nome:

Seu eMail:

ALTERAR PARA MODO HTML
Mensagem:

[:)] = 
[:P] = 
[:(] = 
[;)] = 

HTML DESLIGADO

     
 VOLTAR

  



CyberWEB Network Ltda.    © Copyright 2000-2025   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página