group records on the basis of created_at