True fix for parent_prefix
True fix for parent_prefix

So, the old fix, which I really thought worked, did not work for all
scenarios. As soon as there were no matches at all inside a
parent_prefix, it broke.

This time around I've restructured the SQL query somewhat, moving
conditions from the WHERE clause into the join between p1 and p2. The
old structure was a bit of a mix between implicit and explicit join
syntax and this brings it together under a explicit join syntax. Easier
to read IMHO.

One thing I'm not too happy with is that we change from a JOIN to a LEFT
OUTER JOIN when in "parent_prefix mode". I don't like changing
"structural" parts of the SQL query, but I'm not sure what can be done
about it.

Perhaps we should rewrite this entire SQL query...

Part of #206.

SpriteLink/NIPAP,fredsod/NIPAP,garberg/NIPAP,SoundGoof/NIPAP,ettrig/NIPAP,garberg/NIPAP,fredsod/NIPAP,ettrig/NIPAP,garberg/NIPAP,fredsod/NIPAP,SpriteLink/NIPAP,SpriteLink/NIPAP,SpriteLink/NIPAP,ettrig/NIPAP,plajjan/NIPAP,SoundGoof/NIPAP,garberg/NIPAP,plajjan/NIPAP,bbaja42/NIPAP,plajjan/NIPAP,SoundGoof/NIPAP,plajjan/NIPAP,bbaja42/NIPAP,bbaja42/NIPAP,ettrig/NIPAP,bbaja42/NIPAP,fredsod/NIPAP,fredsod/NIPAP,SpriteLink/NIPAP,bbaja42/NIPAP,fredsod/NIPAP,garberg/NIPAP,plajjan/NIPAP,SoundGoof/NIPAP,SoundGoof/NIPAP,bbaja42/NIPAP,ettrig/NIPAP,ettrig/NIPAP,plajjan/NIPAP,garberg/NIPAP,SpriteLink/NIPAP,SoundGoof/NIPAP