Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2006
    Posts
    110

    Unanswered: Count and using IN

    Good afternoon all,

    I am having trouble getting an accurate count for my query.

    I have

    select count(ID) as Cnt from Users
    where status in ('ACTIVE','INACTIVE','HOLD')
    and IdNumber = '4422'


    I should be getting a count of 3, but I always get only 1.

    I noticed when I take off the IN() I get an accurate count. Is there something wrong with using IN with count ?


    Thanks

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by cmays637 View Post
    Is there something wrong with using IN with count ?
    nope

    please dump your three rows (use mysqldump)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2012
    Posts
    213
    Hi,

    Or to check the result try execute the SQL statement below:

    Code:
    select * from Users
    where status in ('ACTIVE','INACTIVE','HOLD')
    and IdNumber = '4422'

Posting Permissions

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