First row data First Next time if present get another row value

should be implementable with a group by approach