Extract String Using Sql Aggregate