Groups | Blog | Home
all groups > sql server mseq > february 2005 >

sql server mseq : select count (distinct X, Y)


Ronan
2/8/2005 2:29:03 AM
Hi all,

I'm trying to make this query:
select count (distinct UC_CODE, SYNT, SUPER)
FROM PLAN_RB
WHERE HYPER IS NULL
AND SUPER IS NOT NULL

and I have this message:
Incorrect syntax near ','

What I want to find is the total number of lines...

Do you know a way to solve this problem. It seems I cannot have several
values with a "count(distinct )" but I can't find any way to do it...

Thanks for your help.

Ronan
Hugo Kornelis
2/8/2005 12:04:58 PM
[quoted text, click to view]

Hi Ronan,

Here's a workaround, using a derived table:

SELECT COUNT(*)
FROM (SELECT DISTINCT UC_Code, Synt, Super
FROM Plan_DB
WHERE Hyper IS NULL
AND Super IS NOT NULL) AS Der
(untested)

Best, Hugo
--

AddThis Social Bookmark Button