I didn't realize your top level had a parent ID equal to its Individual ID. You'll need to add a test for that to the Where clause.
To put them in separate temp tables, just split up the two CTEs into two separate queries.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon