Fixed SQL query for parent_prefix

AFAIK, this does everything we want. I had to put in an extra condition
to the JOIN as that speeds up the query tremendously.

Hope it holds up in a production environment too. Test database I have
is few VRFs but in excess of 10000 prefixes so results should hopefully
not be too far off.

This fixes #206.