On Fri, Dec 06, 2002 at 05:54:53PM +0100, Alliax wrote:
> I have one question : if I go the RestTimes route, that is having a row per
> day and so 7 row per restaurants : can I, in one SQL request, know if THAT
> restaurant is open or close now ? I now there are NOW() function in SQL and
> probably many others, but I am not at ease to use them since I have pretty
> basic SQL skills.
 
This should be a personal work assignment for you, but try:

SELECT * FROM RestTimes WHERE RestID = ... AND OpenTime < now() 
and CloseTime > now();

FWIW, you'll have to do a calculation in there such that OpenTime is midnight 
today + seconds from day offset.  Its not difficult; find some calendaring 
code for examples.
-- 
Michael T. Babcock
CTO, FibreSpeed Ltd.     (Hosting, Security, Consultation, Database, etc)
http://www.fibrespeed.net/~mbabcock/

---------------------------------------------------------------------
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

Reply via email to