SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up searching between dates

    hi
    i have one date filed in my table and user has to select the two dates(form and to) from the search form to search the data between the two dates e.g all the data between 2005-01-01 and 2005-08-05. what query i have to make????
    its urgent plzzz.....
    regards
    phphelp

  2. #2
    Free your mind Toly's Avatar
    Join Date
    Sep 2001
    Location
    Panama
    Posts
    2,182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    select
        *
    from
        table_name
    where
        date_field
    between
         '2005-01-01'
      and
         '2005-08-05'
    Community Guidelines | Community FAQ

    "He that is kind is free, though he is a slave;
    he that is evil is a slave, though he be a king." - St. Augustine

  3. #3
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    bahrain
    Posts
    553
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i tried with this but not working?????
    its urgent plzzz.....
    regards
    phphelp

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,016
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    please show us the CREATE TABLE statement, and a couple of rows of sample data

    p.s. how can it be urgent if your sig says "its urgent plzzz" on every post you make?
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1) are you actually using a date type for your dates or varchar? varchar won't do any date calculations correctly

    2) if it is urgent plzzz how come you haven't looked at the thread in six hours? :-)


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
  •