Fix query with joins.

We were selecting columns from all tables, which led to the table not
being processed at all.