0
I’m a beginner in SQL Server
, would like a help to understand the function Group By
in a simple way. Both your concept and the way to use... for those who can help me thank you already!
0
I’m a beginner in SQL Server
, would like a help to understand the function Group By
in a simple way. Both your concept and the way to use... for those who can help me thank you already!
3
There are some functions like COUNT, MAX, MIN, SUM and AVG, in which they group some results, let’s assume you do:
select COUNT(nome) from pessoa
This will group all the names in a result, generating then the account the names, let’s assume that we have 4 names the result of the sum would be 4.
But let’s assume you wanted to count the same names, so you would
select COUNT(nome) from pessoa group by nome
So he’s going to group all the names equal and show the amount, so let’s assume that of these 4 there are two names equal john and the other two different, then the result would be 2 because of the two john and then we would have two more results 1 and 1 referring to the different names that remained.
See some examples
Browser other questions tagged sql sql-server
You are not signed in. Login or sign up in order to post.
great example, it was much easier to understand how to use the function... thanks for the help!
– Danilo Vilhena