RE: [PHP-DB] Select where date is in period
| From: | Allsebrook_Richard/askr at askr dot easysoft dot com | Date: | Thu, 22 Mar 2001 10:26:04 +0000 |
| Subject: | RE: [PHP-DB] Select where date is in period | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-7693@lists.php.net to get a copy of this message | ||
Have you checked at the BETWEEN (x and y) clause?
e.g.
SELECT * FROM table WHERE searchdate BETWEEN (date_online AND
date_offline)
Not tested this on MySQL, but the above is perfectly legal SQL92.
Hope this helps.
_____
~ Richard Allsebrook ~
Applications Developer and Webmaster
Easysoft Limited, Thorp Arch Grange, Thorp Arch, Wetherby, LS23 7BA, UK
http://www.easysoft.com <http://www.easysoft.com> -
http://www.cinema.com <http://www.cinema.com>
"A computer lets you make more mistakes faster than any invention in
human history - with the possible exceptions of handguns and tequila."
_____
-----Original Message-----
From: boclair [mailto:boclair@bigpond.net.au]
Sent: Thursday, March 22, 2001 6:05 AM
To: php-db
Cc: boclair
Subject: FW: [PHP-DB] Select where date is in period
The database has a table of equipments with date fields for
date_online and date_offline.
The requirement is to find which equipments were available on a date
specified by the user, this being a variable created by the user.
My attempts at scripting for the condition where the date_online <=
'specified variable' and the date_offline => 'specified variable'
totally fail for syntax says mySQL (and possibly for method)
I would be grateful for help or a pointer to a reference.
Tim Morris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
Attachment: [application/rtf]
Attachment: [application/rtf]