Steve Jones - SSC Editor (1/16/2013)
This kind of works, but I'm wondering if you've calculated something in this view already.
SELECT cid, COUNT(DISTINCT ccid)
FROM dbo.MyTable
GROUP BY cid
I think this should be fine ..If not please post the ddl's .I am unable to understand the problem..
this is how I tried , le me know it works for you..
CREATE TABLE #test
(
CID INT,
CCID CHAR(10),
CCOUNT INT
)
INSERT INTO #test
VALUES (2,'a',1),
(2,'b',1)
-- Edited this part
SELECT *,
(SELECT SUM(ccount) FROM(SELECT CCOUNT
FROM #test GROUP BY CID,CCOUNT)abc)CountTotal
FROM #test
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm: