Split main query to generate custom row.