﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / In --&amp;gt; Group By with Multiple columns...&amp;gt; how it will responds / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 20 Jun 2013 04:20:11 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: In --&amp;gt; Group By with Multiple columns...&amp;gt; how it will responds</title><link>http://www.sqlservercentral.com/Forums/Topic1423210-392-1.aspx</link><description>Below is a basic example for Group By[code="sql"]CREATE TABLE #Studentcourseschedule(Department int,Courseid int,studentid int)goinsert into #Studentcourseschedule(Department, Courseid,studentid)values(1,1,1),(1,2,1),(1,3,1),(1,1,5),(1,3,6),(1,1,7),(2,2,1),(2,1,2),(2,3,2)goselect department, COUNT(studentid) Studentcountfrom #Studentcourseschedulegroup by departmentorder by Departmentgoselect department, courseid, COUNT(studentid) Studentcountfrom #Studentcourseschedulegroup by department,courseidorder by Department, Courseid[/code][u]1st Query Result:[/u]department	   Studentcount1	           62	           3[u]2nd Query Result[/u]department	courseid	Studentcount1	        1	        31	        2	        11	        3	        22	        1	        12	        2	        12	        3	        1In the first query the grouping is done only on Department, so it checks the no of students in each of the Department available in the table which is 1 and 2 in exampleWhen we add another group by column on courseid, now it looks for the each course available under each department and displays count of the student in that department and course.</description><pubDate>Sun, 24 Feb 2013 21:11:32 GMT</pubDate><dc:creator>dgowrij</dc:creator></item><item><title>RE: In --&amp;gt; Group By with Multiple columns...&amp;gt; how it will responds</title><link>http://www.sqlservercentral.com/Forums/Topic1423210-392-1.aspx</link><description>query isselect col1, col2, col3.... from table Group BY Colm, ColnHere my question is :: while we take 2 or more  colmuns in Group By..Actually how it works</description><pubDate>Fri, 22 Feb 2013 22:32:38 GMT</pubDate><dc:creator>r.dilliprasad</dc:creator></item><item><title>RE: In --&amp;gt; Group By with Multiple columns...&amp;gt; how it will responds</title><link>http://www.sqlservercentral.com/Forums/Topic1423210-392-1.aspx</link><description>the title of your post [i] "In --&amp;gt; Group By with Multiple columns...&amp;gt; how it will responds  " [/i] is not enough for us to go by;can you explain your question better? do you have a coded example that's not working as expected?</description><pubDate>Fri, 22 Feb 2013 12:40:03 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>In --&amp;gt; Group By with Multiple columns...&amp;gt; how it will responds</title><link>http://www.sqlservercentral.com/Forums/Topic1423210-392-1.aspx</link><description>can any please help me...!Thanks &amp; RegardsPrasad Reddy</description><pubDate>Fri, 22 Feb 2013 12:11:58 GMT</pubDate><dc:creator>r.dilliprasad</dc:creator></item></channel></rss>