Sort error-prone SQL joins.

When joining make sure to make it clear from which table
the column should be fetched from.

git-svn-id: http://textpattern.googlecode.com/svn/development/4.x@5253 2fea6a4d-a838-0410-917b-93a53c48e9d2