Merging queries