gets a query