SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    select results from specific week

    so i have a bunch of timestamps saved in my database, and im trying to return the results from a certain week. Say week 5 of this year (first week of feb).

    im trying something like this but its not working

    SELECT * FROM table where WEEK(timestamp) = '5'

    am i missing something?

  2. #2
    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)
    im trying something like this but its not working
    would you care to enlighten us further?

    Is your column actually called TIMESTAMP? OR do you need to substitute the correct column name?

    When you state "not working" that doesn't give enough details for people to help you.

  3. #3
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    by not working, i mean its not returning any results.

    the column is actually called date so.
    SELECT * FROM table where WEEK(date) = '5'

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,247
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    if that query is not returning any rows, that means there aren't any rows which satisfy that partucular WHERE clause
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •