Update samples with group by statements