assemble query