Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Counting unique records from 2 columns in SQLServer

$
0
0
Please need help to solve this issue
I have a table Meeting
PersonOne    PersonTwo
Ajay        Bharat
Ajay        Elas
Chetan        Deepak
Deepak        Chetan
Chetan        Deepak
Farooq        Ajay
Anil        Sanjay
Gaganan     Hassan
Hassan        Isqh

Output should be
PersonOne    PersonTwo    
Anil        Sanjay
If user wants to show only persons  who have attended meeting only once
here Bharat as attanded meeting only once but he had attended meeting with ajay, who had attended the meeting more then once. so Bharat should not show in the list

Output should be
PersonOne  PersonTwo    
Chetan        Deepak
Deepak        Chetan
Chetan        Deepak

If user wants to show only persons  who have attended meeting for third time
I have tried almost all possible statements , like ,ROW_NUMBER() ,RANK() ,DENSE_RANK()  
,NTILE but result..plz need your help

Viewing all articles
Browse latest Browse all 23857

Trending Articles



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