That syntax does not seem to work for the sqlite version I am using (2.8.0). I get the following:
Sqlite> select count(DISTINCT fieldname) from tablename; SQL error: near "DISTINCT": syntax error Is this a know limitation in 2.8.0? I am sort of stuck with this version because it is integrated into the project. Can someone suggest an alternative? Shawn M. Downey MPR Associates 632 Plank Road, Suite 110 Clifton Park, NY 12065 518-371-3983 x3 (work) 860-508-5015 (cell) -----Original Message----- From: Brass Tilde [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 9:13 AM To: [EMAIL PROTECTED] Subject: Re: [sqlite] counting distinctly > Hello, I am new to sqlite and I wish to get the count of unique entries > in a particular field. The table is created as follows: > I get an error with the query: > select (distinct fieldname) from tablename; > but this gives me the wrong answer: > select distinct (fieldname) from tablename; That statement will get you the distinct records themselves, and you could count by looping through the records. However, if all you want is the count of records, you need to use: select count(distinct fieldname) from tablename or whatever the syntax is for count.