using System.Collections.Generic;
public static void Main()
List<TrackList> inputList = new List<TrackList>
new TrackList { Id = 1, Name = "aaa", Apr_By = 1, Reg_By = 1 },
new TrackList { Id = 2, Name = "bbb", Apr_By = 2, Reg_By = null },
new TrackList { Id = 3, Name = "ccc", Apr_By = null, Reg_By = 3 },
new TrackList { Id = 4, Name = "ddd", Apr_By = null, Reg_By = null }
List<TrackListMain> result = (inputList.Where(x => x.Apr_By == null && x.Reg_By == null)
.Select(x => new TrackListMain
.Union(inputList.Where(x => x.Apr_By != null)
.Select(x => new TrackListMain
.Union(inputList.Where(x => x.Reg_By != null)
.Select(x => new TrackListMain
FiddleHelper.WriteTable(result);
public int Id { get; set; }
public string Name { get; set; }
public int? Apr_By { get; set; }
public int? Reg_By { get; set; }
public class TrackListMain
public int Id { get; set; }
public string Name { get; set; }
public string Status { get; set; }