>I figured out why the GROUP BY approach was so slow. You were trying to get the same result as the original query, since you were grouping by PK and ChildPK.
>
>Either my or Boris solution will work (or any of the approaches listed in the referenced blogs). You don't need to save the result in the temp table either.
>
>My approach probably would be easiest to introduce since it only requires adding one extra field to the original query.
Thanks, I will have to take a look at this one later.