martedì 1 settembre 2009

[SQL] [ACCESS] - COUNT DISTINCT in Access

In DB come SQL Server, Oracle e MySql, la funzione COUNT(Distinct) conta il numero di termini univoci in un dato rowset.

SELECT Count(Distinct risposte) AS R FROM tRisposte

In Access per fare la stessa cosa dobbiamo invece scrivere:
SELECT Count(*) AS R
FROM
(SELECT DISTINCT risposte FROM tRisposte) AS T;