PDA

View Full Version : MySQL query to return date?



vishzilla
January 16th, 2009, 05:40 AM
I would like to know if its possible to return dates for entries older than a month for example.

cl333r
January 16th, 2009, 05:46 AM
A quick google yields:

http://www.tizag.com/mysqlTutorial/mysql-date.php

vishzilla
January 16th, 2009, 06:01 AM
I didn't make myself clear. I have these entries in the tables with timestamps ranging for the last 3 months. How can I return entries older than a month ignoring the recent one month entries. I am using Perl to access the database

sunset_studies
January 18th, 2009, 07:07 AM
please post the 'table create' code so we can see what type of column is being used to store the dates. :)

CodeBird
January 18th, 2009, 10:59 AM
SELECT columns FROM table WHERE date_column < DATE_SUB(now(), INTERVAL 1 MONTH);

this should be it unless u used a weird type for the date_column