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 flexibility

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-11-08 : 07:22:14
Ju Che writes "Hi,

I have table with four columns (A, B, C, D).
I need something like this :

SELECT COUNT(A) FROM MyTable GROUP BY A, B, DISTINCT(C), DISTINCT(D)

But I cann't use DISTINCT in GROUP BY clause. How can I write it using legal SQL query ???

I will really thanful you if you help me, much thanks."

nr
SQLTeam MVY

12543 Posts

Posted - 2004-11-08 : 08:58:03
>> I need something like this
I very much doubt it.
What are you trying to do? A group by has distinct values for the group fields so distinct would be meaningless there.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -