PDA

View Full Version : sql statement to select by date parameter


jamesthecat
06-04-2003, 10:43 AM
Hi,
I have a news and events database and I would like to be able to display the news items on my web page by the most current, say everything in the last month, and also automatically archive the rest so if they are older than a month, they are displayed on the archive page.

At the moment I have a field named STATUS which contains items called CURRENT, ARCHIVE and STORE. This allows me to manually update my pages but it would be more efficient if I could have a stored procedure that would do it automatically.

Thanks in advance!

jtc

raf
06-04-2003, 03:40 PM
MySQL doesn't have stored procedures yet (on the development list). But you could use a CRON job (if your host supports that) to update the database each first day of the month or so. (i suppose that is what you mean by updating your pages)

jamesthecat
06-04-2003, 03:43 PM
Sorry - I wasn't very clear. I'm actually using SQL Server and in my amateurish frenzy to find a solution I just posted to the first thing I could find which vaguely resembled SQL. I realise now that they are totally different.

Got the result I was looking for though from another forum but thanks for your response.

JTC