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)
 Group by *

Author  Topic 

seyha_moth
Yak Posting Veteran

74 Posts

Posted - 2006-12-11 : 22:31:54
Dear Sir or Madam

I have a problem related to sql query is that I use cross tab query and I want to
Select r* from tbl r where r.studentID='77' Group by *

Can I write it? or you have another methods?

Thank you in advance.



seyha moth

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-12 : 00:08:14
You can't use * in group by.

If you want to group by all fields, what's the purpose of using Group By.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

seyha_moth
Yak Posting Veteran

74 Posts

Posted - 2006-12-12 : 03:11:03
Thank you for your reply I found the solution by using cursor then I have finished to create it already

Thank you for your help
I hope that you will help me if I have any problem related to SQL Server

Good Bye!!
Good Luck and Succed your work!



seyha moth
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-12 : 03:16:36
Another method that produces the EXACT SAME OUTPUT is

select distinct * from tbl where studentid = 77


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-12 : 05:34:19
You cant use * in Group by or Order by
Group by * is exactly equivalent to DISTINCT * as suggested

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -