how to do a quary