"Brass Tilde" <[EMAIL PROTECTED]> writes: >> And COUNT doesn't take any arguments anyway, besides '*', as >> they don't make sense. > > On MS SQL Server 2000, one can pass a field name to the COUNT function, and > though I haven't yet seen any difference in the results between the two, the > queries run faster with COUNT(<field>) than with COUNT(*).
COUNT(fieldname) provides the count of rows where the data in 'fieldname' is non-null. COUNT(*) provides the total count of rows: sqlite> .dump BEGIN TRANSACTION; create table test (ip, domain); INSERT INTO test VALUES('128.205.7.57','acsu.buffalo.edu'); INSERT INTO test VALUES('128.205.7.57','acsu.buffalo.edu'); INSERT INTO test VALUES('128.205.7.57','acsu.buffalo.edu'); INSERT INTO test VALUES('68.85.92.99','eye-catcher.com'); INSERT INTO test VALUES('1.2.3.4',NULL); COMMIT; sqlite> select count(*) as allCount, ...> count(ip) as ipCount, ...> count(domain) as domainCount ...> from test; allCount = 5 ipCount = 5 domainCount = 4 sqlite> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]