2
I have a table with the following structure
|id|parent_id|name|
At some point, due to a programming error, some parents were erased and their children remained.
So I need to create a query to fetch all these children.
I tested this query:
SELECT filha.id, filha.name FROM filha WHERE (SELECT pai.id, pai.name FROM pai WHERE pai.id = filha.pai_id) = NULL
But my structure is on the same table.
What in this table says that the item is child ? what is the item parent? vague in this respect? is a relationship self, but, how does it work in your case
– novic
Just complementing the questions of Virgilio, give an example of what has in your table and with this data what you want to have return
– Sorack