get result set from query.