Hi Guys,
I am not sure if I should do this in the code or do it in the query, but I will ask it here as I am interested in a sql solution for myself.
Say if I have the following table, and I need to get all the rows whose ParentSID is 1. But if any of these rows return have Null as FID then I also need to go fetch all rows whose ParentSID is the SID of the row whose FID was Null.
There is no limitation and it could go on and on where the records return could have Null as FIDs and I have to find all rows with its ParentSID.
----------------------
SID FID ParentSID
1 null null
2 null null
3 16 1
4 17 1
5 null 1
6 18 5
7 19 2
----------------------
I have iterative solution in code but I have to go back multiple times to the database to get the complete list I am interested in and I am sure having a SQL procedure would make much more sense, but I am not sure how to do it?
Thanks,
Voodoo