I have a table like the following
id | name | pid
1 | sam | NULL
2 | sams ref | 1
3 | pam | NULL
For the first time the first row gets inserted which will have pid as null
I insert a row which is related to the first row
and then i insert a row which is new and which may be referred by another row in future.
now i want only the third row to be displayed and not the first and second row as the second row contains the reference of first row.
so if any row has a reference to another row then both the rows should not be displayed.
Only rows which is not having any reference should be displayed.
BESIDES, IS IT A GOOD PRACTICE? PLEASE ADVICE ON THIS.
use
OR
As to whether this is good pratcice:
without knowing the requirements etc. I don’t see how to discuss this…