SQL: How do you count the number of unique records? -


i'm new sql , sorry if q has been asked before - couldn't phrase properly.

say have table looks this:

name    call id sally   1 sally   2 sally   3 mike    4 mike    5 bob     6 bob     7 

i want create new table looks this:

name    no. of calls sally   3 mike    2 bob     2 

attempt

i assume like:

select  name,  count(distinct name) no. of calls  table 

thanks.

you need group them , that's all.

select      name      count(*) [no. of calls]      table group      name 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -