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

 

  Fórum

  Visual Basic
Voltar
Autor Assunto:  Comando SQL
Vinicius
não registrado
Postada em 02/03/2005 16:06 hs   
Caros Colegas,
Estou querendo fazer um camando SQL que retorne a maior data de um determidado registro na tabela. Vou tentar exemplificar:
Codigo       Data         Descricao
1             01/01/05       xxxxxxxxxxxxxx
1             05/05/05        wwwwwwwwwww
2             06/05/05       ssssssssssssssssss
2             31/12/05       yyyyyyyyyyyyyyyy
 
O camando Sql deve retornar o 2º e o 4º registro da tabela.
 
Obrigado.
     
kerplunk
Pontos: 2843 Pontos: 2843 Pontos: 2843
SÃO PAULO
SP - BRASIL
Postada em 02/03/2005 16:38 hs         
select max(data) from tabela
 
isso retornaria o 4 registro... agora para retornar o segundo maior e o maior... dae eu num sei como eh..,.
 
     
Keyo
Pontos: 2843
CURITIBA
PR - BRASIL
ENUNCIADA !
Postada em 04/03/2005 17:32 hs            
Nossa se eu compreendi e muito simples
 
"select top 2 * from tabela order by data desc"
   
Página(s): 1/1    


Seu Nome:

Seu eMail:

ALTERAR PARA MODO HTML
Mensagem:

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

HTML DESLIGADO

     
 VOLTAR

  



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