Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    87

    Unanswered: getting values nulls and year datepart...

    HI everybody need to count active members for the year 2009 from members table. The criteria is that dateleft is not null and the count should also exclude all members with dateleft having the year 2010

    have this query but doesn't work and gives me wrong results...

    SELECT COUNT(ID) AS ActiveMembers
    FROM members
    WHERE
    (DateLeft IS NULL OR NOT (DatePart(year,DateLeft) = 2010))

    thanks

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by alexiop View Post
    have this query but doesn't work and gives me wrong results...
    These being?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by alexiop View Post
    dateleft is not null and the count should also exclude all members with dateleft having the year 2010
    have this query but doesn't work and gives me wrong results...
    Quote Originally Posted by alexiop View Post
    WHERE
    (DateLeft IS NULL OR NOT (DatePart(year,DateLeft) = 2010))
    Quote Originally Posted by alexiop View Post
    gives me wrong results...
    Somehow I'm not surprised at all.
    ---
    "It does not work" is not a valid problem statement.

Posting Permissions

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