Quantcast
Viewing all articles
Browse latest Browse all 10045

Count Distinct Values

I have two datasets.

Dataset1:

CREATE TABLE #a (Ca nvarchar(20),PERSON NVARCHAR(20));

INSERT INTO #A VALUES ('A','R'),('A','T'),('A','W');
INSERT INTO #A VALUES ('B','R'),('B','M'),('B','R');
INSERT INTO #A VALUES ('C','M')

SELECT * FROM #A

Dataset2:

CREATE TABLE #B (TT nvarchar(20),Ca nvarchar(20));

insert into #b select 'O','A'
insert into #b select 'O','B'
insert into #b select 'O','C'

select * from #b

I insert the table using dataset2 as Dataset Name. However as I can get distinct person in group A,B,C, I do not know how to get total group O person number. Total number should be 4. It would be appreciate that you can provide some ideas.

Image may be NSFW.
Clik here to view.


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>