Hi
Try like this, this might help you..
class Program
{
static void Main(string[] args)
{
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Result", typeof(string));
dt.Rows.Add("John", "1,2,3,4,5");
dt.Rows.Add("Mary ", "5,6,7,8");
dt.Rows.Add("John", "6,7,8,9");
DataTable dtRsult = dt.Clone();
var distinctRows = dt.DefaultView.ToTable(true, "Name").Rows.OfType<datarow>().Select(k => k[0] + "").ToArray();
foreach (string name in distinctRows)
{
var rows = dt.Select("Name = '" + name + "'");
string value = "";
foreach (DataRow row in rows)
{
value += row["Result"] + ",";
}
value = value.Trim(',');
dtRsult.Rows.Add(name, value);
value = "";
}
var output = dtRsult;
}
}