linking to queries