MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Michael Stassen Date:October 18 2005 7:06pm
Subject:Re: Fw: query help
View as plain text  
grKumaran wrote:
> 
> Hello Folks,
> 
> It is great help.  Thank you all and specially for Michael and Shawn.  It
> does work properly in 4.1.9-max.  But I think, LAST_DAY function does not
> availble in old MySQL version 4.0.??, so there I have problem, actually our
> webserver is still in that version.  So I request any help to alter the
> query to work in previous version too, and it will be greatly appreciated.
> 
> Thanks in advance for the answer.
> 
> Greetings,
> R.Kumaran

I was afraid that might be the case.  Usually the manual says when a 
function was introduced, but not so for LAST_DAY().  In that case, you can 
use DATE_FORMAT to accomplish the same thing:

   SET @start = DATE_FORMAT(CURDATE() - INTERVAL 1 YEAR + INTERVAL 1 MONTH,
                            '%Y-%m-01');

   SELECT * FROM t
   WHERE dt >= @start;

Michael
Thread
Fw: query helpgrKumaran18 Oct
  • Re: Fw: query helpSGreen18 Oct
  • Re: Fw: query helpDobromir Velev18 Oct
    • Re: Fw: query helpMichael Stassen18 Oct
Re: Fw: query helpgrKumaran18 Oct
  • Re: Fw: query helpMichael Stassen18 Oct
Re: Fw: query helpMichael Stassen18 Oct