Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select from Table where Age is one week

Status
Not open for further replies.

Geronantimo

Technical User
Apr 3, 2006
79
SE
I think the Subject line is slightly cryptic...

I have a simple query that outputs the records from a table that have dates 'entered' after 2008-04-01:

Code:
SELECT * FROM table_user w
WHERE w.`entered` >= '2008-04-01';

I am a complete novice trying to learn to perform some queries on my database and I would like to change the above query so that it returns all of the records that are one week old.

Is this possible and if so, could somebody please show me how?

Thanks


 
Hi again,

I have changed the query to this:

Code:
SELECT * FROM table_user w
WHERE w.`entered` >= NOW() - INTERVAL 7 DAY;

Is this good or bad "MySQL"?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top