-
Hi Guys, I need to be pointed in the right direction
I have this sticky situation where I have a table with a parent/child relationship in which I have to match the child field information to match the parent.
DocID AttachID ProdField
1.94.2560 1 abc123
1.94.2561 1 Null
1.94.2567 6 def456
1.94.2568 6 Null
1.94.2569 6 Null
1.94.2570 6 Null
1.94.2571 6 Null
What I would like to do is to use the AttachID to recursively go down the column and update the Prodfield according to the first distinct AttachID. The output would look like this
DocID AttachID ProdField
1.94.2560 1 abc123
1.94.2561 1 abc123
1.94.2567 6 def456
1.94.2568 6 def456
1.94.2569 6 def456
1.94.2570 6 def456
1.94.2571 6 def456
My thought process is that I would have to use a combination of CTE and update or maybe a CASE statement to make this work. However, at this moment, I am just spinning my wheels and I figured some fresh eyes probably could point me in the right direction.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|