In response to
"TFW you send 60 minutes wrestling with a SQL query and you're still not even sure why it works now (geek overload)"
by
oblique
|
You are correct in that the first one yields a list of IDs which are not themselves Parent_IDs, but that's not what you want.
|
What you want is the list of IDs which _do not have_ a Parent_ID. In the second SQL statement, the subquery returns that list of those that do have a parent, and then you negate it.
|