Tweak reports query generator to reference table names

Fixes #5278