try
SELECT id,(TO_DAYS(firstdate)- TO_DAYS(postdate)) AS diff FROM calendar
well you have to put the bigger date on the lhs.
Kenneth Letendre wrote:
Hello,
I'm trying to get the difference (in days) between dates stored in two
date fields.
My query:
SELECT id,(firstdate- postdate) AS diff
On Sat, 2004-01-31 at 14:57, Kenneth Letendre wrote:
> Hello,
>
>I'm trying to get the difference (in days) between dates stored in two
> date fields.
>My query:
>
> SELECT id,(firstdate- postdate) AS diff FROM calendar
>
>This works fine if the two dates are in the same month, but
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Saturday 31 January 2004 7:57 pm, Kenneth Letendre wrote:
> Hello,
>
>I'm trying to get the difference (in days) between dates stored in two
> date fields.
You should be able to do this with the TO_DAYS() function, e.g.:
SELECT ID, (TO_DAYS(fi
Just try to access the databases with the permissions that you had previously set up.
If you can then it worked okay. If you can't then use grant to set your permissions up
again.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysq
ings to be portable to
different systems, I suggest using things compatible with 3.23. And
when you have to use something that's not, handle it in your code.
Matt
- Original Message -
From: "Bob Terrell" <[EMAIL PROTECTED]>
Sent: Thursday, January 01, 2004 5:35 PM
Subje
endar
Dan
-Original Message-
From: Matt W [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 01, 2004 4:42 PM
To: [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: Subtracting date fields
Dan,
DATEDIFF() only works in MySQL 4.1.1+.
RTFM! ;-)
Matt
- Original Message -
From: <[EM
Dan,
DATEDIFF() only works in MySQL 4.1.1+.
RTFM! ;-)
Matt
- Original Message -
From: <[EMAIL PROTECTED]>
Sent: Wednesday, December 31, 2003 2:10 PM
Subject: RE: Subtracting date fields
> Kenneth,
>
> try
>
> SELECT id, DATEDIFF(firstdate, postdate) AS
on 01/31/2004 11:57 AM, Kenneth Letendre at [EMAIL PROTECTED]
wrote:
> Hello,
>
> I'm trying to get the difference (in days) between dates stored in two
> date fields.
> My query:
>
> SELECT id,(firstdate- postdate) AS diff FROM calendar
>
> This works fine if the two dates are in the same m
Kenneth,
try
SELECT id, DATEDIFF(firstdate, postdate) AS diff FROM
calendar
RTFM!
hope that helps, dan
-Original Message-
From: Kenneth Letendre
[mailto:[EMAIL PROTECTED]
Sent: Saturday, January 31, 2004 1:51 PM
To: [EMAIL PROTECTED]
Subject: Subtracting date fields
Hello,
I
Hello,
I'm trying to get the difference (in days) between dates stored in two
date fields.
My query:
SELECT id,(firstdate- postdate) AS diff FROM calendar
This works fine if the two dates are in the same month, but not
otherwise. MySQL appears to be treating the two dates as base-10 int
Hello,
I'm trying to get the difference (in days) between dates stored in two
date fields.
My query:
SELECT id,(firstdate- postdate) AS diff FROM calendar
This works fine if the two dates are in the same month, but not
otherwise. MySQL appears to be treating the two dates as base-10 int
11 matches
Mail list logo