Intervalo de Acesso

(leandroauler) #1

Pessoal,

Boa noite,

Preciso fazer um select, que mostre o cliente que usou o seu cartao com intervalo menor que 20 minutos.

SELECT Idaut AS ID, NumeroSerie AS CARTAO, DATE_FORMAT(Data,'%d/%m/%Y') AS DATA, SEC_TO_TIME(Hora) AS HORARIO, Aplicacao, Transacao, AplicacaoEmissor, FROM pass WHERE Data BETWEEN '2009-09-01' AND '2009-09-01' ORDER BY CARTAO

Resultado:

ID         CARTAO                 DATA          HORA      APLIC  TSN   APLEMI
8577824;"00102000004451";"01/09/2009";"11:00:40";"400";2478;"001"
8578570;"00102000006665";"01/09/2009";"17:49:13";"400";6346;"001"
8582173;"00102000006665";"01/09/2009";"10:40:58";"400";6345;"001"
8576018;"00102000006681";"01/09/2009";"18:25:25";"400";5079;"001"
8563317;"00102000010141";"01/09/2009";"12:20:30";"400";4488;"001"
8592816;"00102000011901";"01/09/2009";"07:43:04";"400";2092;"001"
8557123;"00102000013149";"01/09/2009";"12:51:24";"400";1654;"001"
8593827;"00102000015079";"01/09/2009";"20:23:36";"400";1163;"001"
8583793;"00102000023217";"01/09/2009";"19:42:53";"400";4299;"001"
8600713;"00102000023217";"01/09/2009";"21:59:28";"400";4300;"001"

Alguem tem alguma idéia?

(Diogo Toscano) #2

Nao seria o mesmo problema de antes? So que pegando a data atual - data do uiltimo registro no banco se é maior que 20 minutos?