1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| SELECT D1.Num, D1.Numartiste, D1.titre, D1.NumCat, D1.Derdiff,
D1.Duree, MIN (Abs (DateDiff ('n', P1.Diff, '24/07/2007 04:35:41'))),
Artistes.NomArtiste, G1.NomGenre
FROM
Disco D1
JOIN Genres G1 ON D1.NumGenre = G1.IDG
JOIN Artistes ON D1.NumArtiste = Artistes.IDA
LEFT JOIN Prog AS P1 ON (Abs (Datediff ('n', P1.Diff, '24/07/2007 04:35:41')) > D1.EcartTitre)
WHERE D1.Num = P1.ID
AND NOT EXISTS
(
SELECT *
FROM Prog P3, Disco D3
WHERE D3.NumArtiste = P3.NumA
AND D3.NumArtiste <> 285
AND D1.Num = D3.Num
AND Abs (Datediff ('n', P3.Diff, '23/07/2007 04:35:41')) < D3.EcartArtiste
)
AND NOT EXISTS
(
SELECT *
FROM Prog P4
WHERE P4.ID = D1.Num
AND Format (P4.Diff, 'dd/mm/yyyy') = '24/06/2007'
AND Abs (Datediff ('n', Format (P4.Diff, 'hh:nn:ss'), '06:00:00')) < 180
)
AND NumCat = 1
AND P1.ID IS NULL
GROUP BY D1.Num, D1.NumArtiste, D1.Titre, D1.NumCat, D1.Derdiff, D1.Duree, Artistes.NomArtiste, G1.NomGenre
ORDER BY 1 / MIN (Abs (DateDiff ('n', P1.Diff, '24/07/2007 04:35:41'))) |
Partager