Select records of last week

2007-02-11 Thread barz040
Hi all I want to extract the records that aren't oldest of 1 week. Ho can I do this in two mode? 1) when my data field is int(10) and I store record with unix time (1171152000) 2) when my data field is a data field and I store record with format 2007-02-11 12:50:02 Thanks -- MySQL General

Select records of last week

2007-02-11 Thread barz040
Hi all I want to extract the records that aren't oldest of 1 week. Ho can I do this in two mode? 1) when my data field is int(10) and I store record with unix time (1171152000) 2) when my data field is a data field and I store record with format 2007-02-11 12:50:02 Thanks -- MySQL General

Re: Select records of last week

2007-02-11 Thread Lars Schwarz
depending on your mysql version: for the date/time field version: select * from foobar where yourdatefield DATE_ADD( CURDATE( ) , INTERVAL -7 DAY ) i don't use unix timestamps, but you may check the UNIXTIME() and UNIX_TIMESTAMP() functions for converting them before using the DATE_ADD().

Re: Select records of last week

2007-02-11 Thread Jay Pipes
Or, another, perhaps easier way: SELECT * FROM foobar WHERE yourdatefield CURDATE() - INTERVAL 7 DAY; Cheers, Jay Lars Schwarz wrote: depending on your mysql version: for the date/time field version: select * from foobar where yourdatefield DATE_ADD( CURDATE( ) , INTERVAL -7 DAY ) i