|
I am getting problem in make a function for the following situation. Suppose i have a table named Opportunity_Duplicate_Tbl
R1,R2.... are just row number and not part of actual data. Here we have two cols Opp_ID and Dup_ID. Here 200,300,400 are duplicates of 111. Total Duplicates of 111 are 3 right now. But 200 and 400 are duplicates of 300 and 101 respectively. Think relation like a=b and b=c, then c=a or a=c also. So total duplicates of 111 are 5.As 101 is duplicate of 100 and 400 is duplicate of 101.. we have ommited the R5 row since 200 and 300 are direct duplicates of 111. So 200,300,400,101 and 100 are total duplicates of 111. I have solve the problem of getting total number of Dup_ID for each Opp_ID. Please help me out. Thanks in advance.
(comments are locked)
|
|
Check out the Books Online on recursive CTE http://msdn.microsoft.com/en-us/library/ms186243.aspx
(comments are locked)
|


What is the desired output for this sample data?