[thelist] comparing dates in mysql

Kae Verens kverens at contactjuggling.org
Mon Feb 24 09:28:01 CST 2003

RUST Randal wrote:
> I need some sql to run that will compare allow me to see if a record is
> more than 30 days old. Is the following appropriate?
> select * from $table where to_days(dateCreated)>30

possibly better (more easily readable) is this:
select field,names from $table
   where dateCreated < (now() - interval 30 day)

Kae Verens               _______\_   webworks.ie
work: www.webworks.ie       _____\\__   webhosts
play: www.contactjuggling.org  ___\\\___  design
kae:  kverens.contactjuggling.org _\\\\____ code

More information about the thelist mailing list