Count Script - SQLServer

0

I have the Telefone table, which records the phones you called. I need to make a script that shows the 'quantity' of the phones they called. if a phone calls more than once does not count. I need to do it via Microsoft SQL SERVER Management QuerySql.

    
asked by anonymous 02.05.2016 / 14:13

2 answers

2

Use the distinct

something like

select count(distinct telefone) as chamadas_distintas
from chamadas
    
02.05.2016 / 15:20
0

That's how it works:

select count(*) num_chamadas_distintas from (
    select distinct numero from telefone
) chamadas_distintas
    
02.05.2016 / 19:32