Depends on the functions that you've got access to the the db (Access will
probably be tougher than MySQL) but you could do something like

SELECT menus.*
FROM menus
WHERE menuId=( WEEK(NOW()) MOD 5 ) + 1

of course this assumes you've got menu's with menuId 1,2,3,4,5.

The functions of course vary db to db, but you're pulling the week number (1
to 53 because of partial weeks) for the current day, dividing by 5, and
taking the remainder. You might have to tweak a little to get it in sync
with which menu is first. Might be a little weird around the end/beginning
of the year depending on how your weekly menu changes. Check the functions
in your db to make sure you've got WEEK and NOW, but most (T-SQL, MySQL,
Oracle, etc) should be fine.

Regards,

John Paul Ashenfelter
CTO/Transitionpoint
[EMAIL PROTECTED]
----- Original Message -----
From: "Kennerly, Rick H CIV" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 9:43 AM
Subject: 5 week rotation


> Seems like someone did this sometime in the recent past, but I couldn't
find
> it in the archives.
>
> 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?  Okay, any ideas at all?
>
> Rick
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Get the mailserver that powers this list at http://www.coolfusion.com

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

Reply via email to