This is one of the things I'd like to see changed in mysql someday.  Date
math has never worked well because it represents dates as numbers -- sort
of.

What I'd like to have is the capability to do is --

     select datetimefield2 - datetimefield1 as timediff

which would save a lot of hassle over the current solution of --

     select unix_timestamp(datetimefield2) - unix_timestamp(datetimefield1)
as timediff

It just seems a little more intuitive than the DATE_ set of functions.



René Tegel <[EMAIL PROTECTED]> wrote:

you try to select the march 87. 2001 ;)
read the manual about date/time conversion and math:

mysql> select current_date(), current_date()-0, current_date()-14;
| current_date() | current_date()-0 | current_date()-14 |
| 2001-04-12     |         20010412 |          20010398 |
1 row in set (0.00 sec)

gl

----- Original Message -----
From: "Chris Harshman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 12, 2001 8:32 PM
Subject: Is this a bug?


> At the first of the month (no changes made to the database; this script
is
> just running SELECT statements at present) the number of rows returned by
> this query dropped noticeably.  Is this a bug, is my query just fubar'd,
> or...?
>
> SELECT account.username AS account_username, customers.username AS
> customers_username, account.accout_no, account.email, customers.last_mod
> FROM account LEFT JOIN customers ON account.username = customers.username
> WHERE (customers.username IS NULL OR customers.username LIKE
> \"%_expired\") OR (customers.last_mod <= current_date() - 14 AND
> customers.access_status = 'D') ORDER BY last_mod";
>





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