get the query working