Hello. On Fri 2002-12-06 at 17:54:53 +0100, [EMAIL PROTECTED] 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. > How can I make a query that would return as well an extra field with a > boolean flag (open/close) ?
You mean something like the following? SELECT IF( NOW() BETWEEN open AND close, "open", "closed" ) FROM your_table WHERE <some_condition> If you want to query only those which are open, you would simply put the BETWEEN condition to the where clause instead. HTH, Benjamin. -- [EMAIL PROTECTED] --------------------------------------------------------------------- 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