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
Post a Comment