I have the following table which represents a child, his siblings and the case they are assigned under. The resource ids represent the house where they were placed together.
child_id|sibling_id|case_id|resource_id 1 8 123 12856 1 9 123 12856 3 11 321 12555 4 12 323 10987 4 13 323 10956 6 14 156 10554 6 15 156 10554 10 16 156 10553 10 17 145 18986 10 18 145 18986 I want to create a new column placed_together which shows a yes or a no for those children that were placed together based on their case_ids. So my result should look like this
child_id|sibling_id|case_id|resource_id|placed_together 1 8 123 12856 Yes 1 9 123 12856 Yes 3 11 321 12555 No 4 12 323 10987 No 4 13 323 10956 No 6 14 156 10554 No 6 15 156 10554 No 10 16 156 10553 No 10 17 145 18986 Yes 10 18 145 18986 Yes Any help would be appreciated. I dont know how to create an if statement based on these conditions since a case_id can be the same for a group but their resource id can be different for one of the child.