Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Posts
    8

    Unanswered: count(1) && count(*) difference

    Hey fellaws!!

    what is the difference between

    select count(1) from table
    and
    select coutn(*) from the table

    Any Comments??

    Thanks

    Tanmay

  2. #2
    Join Date
    Mar 2001
    Location
    Lexington, KY
    Posts
    606
    With modern optimizers there shouldn't be. What does the query plan show?
    Thanks,

    Matt

  3. #3
    Join Date
    Apr 2004
    Posts
    16

    Post hi

    "select count(1)" it will return the first column's count that the column's value is not null
    "select count(*)" will return all count nomatter somecolumn's value is null or not

  4. #4
    Join Date
    Apr 2004
    Posts
    16

    Arrow 不好意思

    i made a mistake
    you can follow this
    http://www.techonthenet.com/sql/count.htm

  5. #5
    Join Date
    Nov 2002
    Location
    Switzerland
    Posts
    524
    count(1) won't access syscolumns
    F. Celaia
    DBA Sybase/DB2/Oracle/MS-SQL

Posting Permissions

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