Re: Fw: query help

2005-10-18 Thread Michael Stassen
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

Re: Fw: query help

2005-10-18 Thread Michael Stassen
Dobromir Velev wrote: Hi, The following query will probably work but I think it will be easier to pass the minimum date from your application. SELECT * FROM t WHERE (year(dt)=year(Now()) and dt(year(dt)=year(Now())-1 and month(dt)>month(Now())) Also you might want to check the other Date and

Re: Fw: query help

2005-10-18 Thread Michael Stassen
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote on 10/18/2005 12:01:50 PM: - Original Message - From: "grKumaran" <[EMAIL PROTECTED]> To: Sent: Tuesday, October 18, 2005 16:08 Subject: query help : Hello, : : CREATE TABLE t ( : dt datetime : ) : : Please assume this is the table st

Re: Fw: query help

2005-10-18 Thread grKumaran
: > : Hello, : > : : > : CREATE TABLE t ( : > : dt datetime : > : ) : > : : > : Please assume this is the table structure and contains thousands of : > records. : > : And I want to list them only last 12 months (that mean last 1 year) : > records : > : exactly. : > : : > : For that I tried using th

Re: Fw: query help

2005-10-18 Thread Dobromir Velev
Hi, The following query will probably work but I think it will be easier to pass the minimum date from your application. SELECT * FROM t WHERE (year(dt)=year(Now()) and dtmonth(Now())) Also you might want to check the other Date and Time functions http://dev.mysql.com/doc/refman/4.1/en/date-and

Re: Fw: query help

2005-10-18 Thread SGreen
[EMAIL PROTECTED] wrote on 10/18/2005 12:01:50 PM: > - Original Message - > From: "grKumaran" <[EMAIL PROTECTED]> > To: > Sent: Tuesday, October 18, 2005 16:08 > Subject: query help > > > : Hello, > : > : CREATE TABLE t ( > : dt datetime > : ) > : > : Please assume this is the table str