Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Grouping order in SQL 2008

Author  Topic 

Informer30
Starting Member

26 Posts

Posted - 2011-11-29 : 16:56:00
Hi All,

I have a basic select statement and I wanted to know is it possible in sql 2008 to order the group by e.g

select field_a, field_b, field_c, field_d
from table_1
where field_a = 'Student'
Group by field_a (Group1),
field_c (Group2),
field_d (Group3),
field_b(Group4)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-30 : 01:35:25
you can
add order by for that
iie,
order by field_a ,
field_c ,
field_d ,
field_b



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Informer30
Starting Member

26 Posts

Posted - 2011-11-30 : 04:00:52
Thanks, that worked...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-30 : 10:46:12
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -