Data/queries: adjust to fit new filters

Slight changes to get our queries working with new filter implementation.
Ido\Query\*historyQuery: subqueries join objects

Each of our history subqueries should be able to join main object
tables on their own for performance reasons.