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


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to