Seleccionar el Num Consecutivo de la fecha Mayor

yeye

New Member
Joined
Jul 18, 2002
Messages
32
Por favor una ayuda así:

Autonum Numsec FechaHTurno
10 10 23/07/02 14:03:05
11 11 23/07/02 14:10:01
12 12 23/07/02 14:18:45
Nesecito obtener el NumSec de la Mayor FEchaHTurno, así:
Numsec FechaHTurno
12 23/07/2002 14:18:45

Tengo esta rutina pero me trae agrupados
SELECT Turnos.Consec, Turnos.NumSec, Max(Turnos.FechaHAtencT) AS MáxDeFechaHAtencT, Turnos.FechaHFinT
FROM Turnos
GROUP BY Turnos.Consec, Turnos.NumSec, Turnos.FechaHFinT
HAVING (((Turnos.FechaHFinT) Is Null))
ORDER BY Max(Turnos.FechaHAtencT) ASC;
así,

10 23/07/02 14:03:05
11 23/07/02 14:10:01
12 23/07/02 14:18:45


Gracias
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Se puede hacer con dos consultas. Primero una para buscar solo el valor máximo y luego otra que utiliza la primera para hacer la comparacion.

Prueba esto:

-Primero crear la tabla "a" con el campo "num" de tipo numerico mas los campos que quieras.

-Luego hacer estas 2 consultas:

(Consulta1)
SELECT Max(a.num) AS MáxDenum
FROM a;

(Consulta2)
SELECT a.*
FROM a, Consulta1
WHERE a.num=[consulta1].[máxdenum];
 
Upvote 0

Forum statistics

Threads
1,217,371
Messages
6,136,176
Members
449,996
Latest member
duraichandra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top