Take into account selected fields in subsequent queries

This fixes the paging, csv and distinct sub-queries.