Quoting "Kennerly, Rick H  CIV" <[EMAIL PROTECTED]>:
> 
> I have 5 fixed-text items in a database that need to rotate display on a
> weekly basis, rotating weekly on Monday (week one: item one; week two, item
> two).  Obviously the purpose of having 5 items is so that the same piece is
> not displayed on the same week of the month every month (they rotate
> forward
> one week each month). It's not an ad, it's a lunch menu.  I can't work out
> an query that will work.  
> 
> Any elegant query ideas?

If they have ID's 1 to 5 it would be something like:

SELECT *
FROM   table
WHERE  ID = Floor((EXTRACT(DAY FROM (CURRENT_DATE - 'startdate')) % 35)/7) + 1

With startdate some arbitrary startdate. (The extensive math is to prevent a
quick repeat at the end of the year, the number of weeks in a year is not a
multiple of 5.)


> Okay, any ideas at all?

More diet variation?

Jochem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to