Question: I have this table on sql sever

```
cstomer |No_Nota
CUS000     | 98342
CUS000     | 98343
CUS000     | 98343
CUS001     | 98355
CUS001     | 98355

```

I would like to count the frequency of each customer. For similar number of no\_nota the value is 1.

I'd like a result like this:

```
cstomer |Frequent
CUS000     | 2
CUS001     | 1

```

Answer: 
You want the distinct count of the column `no_nota`, so that's what you should select...

```
select customer, count(distinct no_nota) as frequent
  from my_table
 group by customer

```
You want to count the result of your select query:

```
    SELECT COUNT(expression)
    FROM tables
    WHERE predicates;

```

Example:

```
    SELECT COUNT(No_Nota) FROM your_table WHERE No_Nota > 0;

```