Hello,

I've got a number of press releases that I'd like to be able to order by year. 
I'd like everything from this now to a year ago (ie. July 29th, 2000) to be 
ordered together and then allow folks to scroll back to the previous year July 
30, 2000 to July 29th, 1999, etc.

Unfortunately I'm not sure how to do this.  I think that this will give me all 
of the records which were published in the last year (sorry leap year folks):

SELECT
        *
FROM
        articlestable
WHERE
        articleSectionID = '$id' AND TO_DAYS(NOW()) - TO_DAYS(date) <= 365)
ORDER BY
        date DESC

However, I'm not sure how to do the next year in which the WHERE clause would 
have to read something like:
WHERE
        articleSectionID = '$id' AND TO_DAYS(NOW()+$year*365) - 
TO_DAYS(date+$year*365) 
<= 365)

But this doesn't insert the number of days into the date field & I'm not sure if 
it's going to work...

Rather skeptical at the moment.

Suggestions would be appreciated.

Mike
-- 
Mike Gifford, OpenConcept Consulting, http://openconcept.ca
Offering everything your organization needs for an effective web site.
Abolish Nuclear Weapons Now!: http://pgs.ca/petition/
It is a miracle that curiosity survives formal education. - A Einstein


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to