379716 visitors has seen the Tim-Carter.com site. Thanks!
321 visitors has seen the Tim-Carter.com site today.
 
 
Search :  
 
>>> Programming >> MSSQL > How to GROUP data with SQL? (This page has been seen 652 times)

How to GROUP data with SQL?

Grouping data is a good way to sort your data. Lets say you have a Table, with alot of records. On each row you had a departmentname field. And you wanted to know how many people is created in each department.

Then you could do like this

SELECT
      DepartmentName,COUNT(*) TotalInDepartment
FROM
      MyTable
GROUP BY DepartmentName




Like (0)
 
Dislike (0)


Keywords for this article:
GROUP BY || COUNT

Post comment

Name:


Comment:

Code Language:

Code:

Here you can paste a code example. It will then be processed by SyntaxHighlighter and formatted for easier readability.
Please remember to select the correct Code Language in the select above so the SyntaxHighlighter can highlight the code properly.




Code:

Please enter the code you see above

What is 7 + 1 =

Submit Comment


No one has commented on this page yet. You could be the first.


Advertisement by Google


Sponsors :