Custom Search Problem - Unknown column contact_a.id in field list when tagging returned contacts
I just tried to reproduce the issue in 4.6.11 and wasn't able to; though, it's possible I didn't pick the "correct" criteria.  I know there has been some work done on the dynamically created sql, which this is, in more recent releases that might have fixed the issue.  I suggest you try to reproduce it in one of the demo databases.

When I've run into things like this before, sometimes, though not always, I can get around the issue by running the query, creating a smart group out of it and then doing an advanced search with the only criteria being the contacts are in that smart group.  Then doing the tags or whatever with that resultant set.