Count script - Sqlserver

Asked

Viewed 47 times

0

I own the table Telefone , that records the phones they called. I need to make a script that shows the number of phones that called. If a phone calls more than once, it doesn’t count. I need to do via Microsoft SQL SERVER Management Querysql.

  • You can post the table structure with data examples before and after?

2 answers

2

Use the distinct

something like

select count(distinct telefone) as chamadas_distintas
from chamadas

0

So it works:

select count(*) num_chamadas_distintas from (
    select distinct numero from telefone
) chamadas_distintas

Browser other questions tagged

You are not signed in. Login or sign up in order to post.