Fixed generated SQL for tagged_with :any

Closes #519.
What exactly doesn't work and in which DB? Can you provide the error message, or something more specific