List:General Discussion« Previous MessageNext Message »
From:grKumaran Date:October 18 2005 10:28am
Subject:query help
View as plain text  
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 the following query, but it list sometimes 13 months
when the current date is in the middle of the month.

SELECT * FROM t WHERE DATE_ADD(dt, INTERVAL 1 YEAR) >= NOW();

I request you to help me.  And thanking you for the consideration.

Sincerely,
R.Kumaran

Thread
query helpgrKumaran18 Oct
  • Re: query helpSGreen18 Oct