Recursive CTE to find parent records

前端 未结 2 1584
孤独总比滥情好
孤独总比滥情好 2020-12-18 03:58

first i must admit that i\'m not very familiar with sql server\'s recursive CTE\'s but i think this is the best approach.

I have a table tabData. Its PK

相关标签:
2条回答
  • 2020-12-18 04:37

    Changing to:

    INNER JOIN PreviousClaims parent ON parent.fiData = child.idData
    

    Gave me the results you wanted.

    0 讨论(0)
  • 2020-12-18 04:41

    You have the join backward.

    Change this

    INNER JOIN PreviousClaims parent ON parent.idData= child.fiData 
    

    to this

    INNER JOIN PreviousClaims parent ON parent.fiData = child.idData
    
    0 讨论(0)
提交回复
热议问题