Results 1 to 3 of 3

Thread: SQL Query not returning all?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    flanders, nj 07836
    Posts
    110

    SQL Query not returning all?

    Anyone know why this query would return 12/1 dates but no 12/31 dates (cut off is 12/30)

    SELECT *
    FROM Tracking
    WHERE (Visited >= '12/01/01') AND (Visited <= '12/31/01')
    ORDER BY Visited DESC

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    Your defined cutoff is at the stroke of midnight 12/31.
    Chances are you want the entire day's activity, so
    you'll get closer to what you intend using < '1/1/1'

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    flanders, nj 07836
    Posts
    110
    Yeah That's what I thought.. just thought it was funny... all my programming, no other language (that I can think of) excluded the day of a '<=' type comparison.. guess SQL is different. I thought maybe it was a known bug since it's the last day of the year, it didn't process it.. The expression is LESS THEN or EQUAL TOO... just funny.. anyway..

    and quick tips on how to advance a form day by 1 in ASP?

Posting Permissions

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



Click Here to Expand Forum to Full Width