Hi,
Dave wrote:
<cut>
> Dim intWeekID
> objRSWeekID.open "SELECT WeekID FROM WeekControl " & _
> " WHERE WeekStart < NOW() AND WeekEnd > NOW()", objConn
>
> intWeekID = objRSWeekID("WeekID")
>
> This fails to bring back a value for WeekID.
>
Just want to mention couple of things:
1. storing both WeekStart and WeekEnd is redundant unless you want Weeks != 7
days long
MySQL will accept following where clause:
... WHERE NOW() BETWEEN WeekStart AND WeekStart + INTERVAL 7 DAY;
> Data exists as :
>
> WeekStart 2002-05-13 00:00:01
> WeekEnd 2002-05-19 23:59:59
2. This is wrong assumption because when you issue NOW() at midnight it will
contain 00:00:00 and will fall out of any of Your weeks :)
In mine above example WeekStart can be DATE type and it will still give you
correct result.
Read more about MySQL Date/Time functions at
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
Having functions like WEEK(date) and TO_DAYS() you might find you don't need to
store even WeekStart.
Questions like "Given NOW() find WeekStart and WeekEnd" can be answered in
single statement in MySQL :)
--
Best regards
--
For technical support contracts, visit https://order.mysql.com/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Alexander Keremidarski <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Sofia, Bulgaria
<___/ www.mysql.com M: +359 88 231668
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php