doryphores / pretty-apod

Pretty APOD - A pretty version of Astronomy Picture Of the Day (htttp://apod.nasa.gov)
1 stars 0 forks source link

Last modified header should take next/previous into account #33

Closed doryphores closed 11 years ago

doryphores commented 11 years ago

Currently last modified is set to current image last updated date but it needs to also take into account the previous and next images (otherwise, next and previous links may be incorrect).

doryphores commented 11 years ago

Investigate LAG, LEAD sql:

SELECT  *, GREATEST(d, p, n) lm
FROM (
    SELECT  publish_date pu,
        updated_date d,
        LAG(updated_date) OVER(ORDER BY publish_date DESC) p,
        LEAD(updated_date) OVER(ORDER BY publish_date DESC) n
    FROM    apod_picture
) AS pd
WHERE   pu = DATE '2012-06-30';