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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 can we use Group by with order by?

Author  Topic 

tusharkashyap
Starting Member

3 Posts

Posted - 2004-12-14 : 02:15:39
I want to use one query that can contain results in group by and also i want that result with order by one field.. means last record shuld come last .. but in my query its giveing first.

select category_name,identifier
from checklist_detail inner join main_categories on cate_id = main_cate_id where chklist_id=100 group by category_name,identifier

in above query my order should be identifier which is varchar field.

Thanks for your time

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2004-12-14 : 02:52:04
you can use order by after the group by clause
select category_name,identifier
from checklist_detail inner join main_categories on cate_id = main_cate_id where chklist_id=100 group by category_name,identifier
order by identifier
Go to Top of Page
   

- Advertisement -