SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Selecting a range of dates.
-
Feb 1, 2005, 14:30 #1
- Join Date
- Jan 2005
- Location
- USA
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Selecting a range of dates.
I have a table with event dates. I want to only show events for the current week. Any events that are more than 7 days old I want to archive so that people can still select them. How would I do this when making a call to the database?
-Mobile
-
Feb 1, 2005, 15:42 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
depends whether you want the current week (e.g. Jan 30 - Feb 5) or whether you want the last 7 days (e.g. Jan 26 - Feb 1)
what do you mean by "archive" them? if you're thinking of moving the rows to a different table, that's generally not a good idea
-
Feb 1, 2005, 17:15 #3
- Join Date
- Oct 2003
- Location
- St. Catharines, ON Canada
- Posts
- 1,708
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I would suggest rather than move any rows that you come up with an archived column, set to 1 if archived, 0 if active. You won't run into performance issues if your table is indexed properly. You can have mysql handle tens of millions of rows, most folks don't need anything that large. No need to separate data if you were thinking of doing so. IMHO anyway.
Bookmarks