That'll only work if the months are in the same year. Here's a more
general one:
SELECT PERIOD_DIFF( EXTRACT( YEAR_MONTH FROM date1 ),
EXTRACT( YEAR_MONTH FROM date2 ) );
Dean Harding.
-----Original Message-----
From: Dogaru Dragos [mailto:[EMAIL PROTECTED]]
Sent: Monday, 24 June 2002 5:30 pm
To: D.K.Dubey; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: get months between two dates
select month(current_date)-month(fild_name) from database where
your_critteria
This should show you the months between the current date and the date
contained in the fild_name
----- Original Message -----
From: "D.K.Dubey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 10:23 AM
Subject: RE: get months between two dates
> Hi Van,
>
> I read that before sending u the query. In that no where is mention to
> subtract the dates and finding the no months between dates.
>
> D K Dubey
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Van
> Sent: Monday, June 24, 2002 11:43 AM
> To: D.K.Dubey
> Cc: [EMAIL PROTECTED]
> Subject: Re: get months between two dates
>
>
> Consider taking a look at the manual:
> http://www.mysql.com/doc/D/a/Date_and_time_functions.html
>
> Perhaps read parts of it, too.
>
> Fix your PC's date (the current year for most of us is 2002). Many of
us
> who
> receive e-mail dated in the past filter it to /dev/null.
>
> Van
>
> --
> =================================================================
> Linux rocks!!! http://www.dedserius.com/
> =================================================================
>
>
> "D.K.Dubey" wrote:
> >
> > Hi, Can anybody tell me how i can calculate the months between two
dates
> in
> > mysql.
> > thanks in advance
> > Regards
> > D K Dubey
> >
>
>
>
> ---------------------------------------------------------------------
> 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
>
---------------------------------------------------------------------
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
---------------------------------------------------------------------
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