query with mids