1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| CREATE TABLE TABLE1
(date_heure DATETIME,
nom_fichier1 VARCHAR(16))
INSERT INTO TABLE1 VALUES ('2005-12-24 14:00:00', 'fichier1')
INSERT INTO TABLE1 VALUES ('2005-12-24 13:00:00', 'fichier1')
INSERT INTO TABLE1 VALUES ('2005-12-24 12:00:00', 'fichier1')
INSERT INTO TABLE1 VALUES ('2005-12-23 14:00:00', 'fichier1')
SELECT *
FROM TABLE1 T1
WHERE date_heure = (SELECT MAX(date_heure)
FROM TABLE1 T2
WHERE DAY(T1.date_heure) = DAY(T2.date_heure)
AND MONTH(T1.date_heure) = MONTH(T2.date_heure)
AND YEAR(T1.date_heure) = YEAR(T2.date_heure))
date_heure nom_fichier1
------------------------------------------------------ ----------------
2005-12-24 14:00:00.000 fichier1
2005-12-23 14:00:00.000 fichier1 |
Partager