SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    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

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Wizard guelphdad's Avatar
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •