you can do this, but the tables should have relationships:
public class Table1 { [Key] public int IDCol{ get; set; } public string Col2{ get; set; } } public class Table2 { [Key] public int IDCol2{ get; set; } public int IDCol{ get; set; } public string Col3{ get; set; } } public class JoiningTable { public int IDCol1{ get; set; } public int IDCol2{ get; set; } public string Col2 { get; set; } public string Col3 { get; set; } } public List<JoiningTable> GetData() { List<JoiningTable> bothTablesData = from t in Table1 join t2 in Table2 on t.IDCol equals t2.IDCol1 select new { IDCol1 = t.IDCol, Col3 = t2.Col3, Col2 = t.Col2 }.ToList<JoiningTable>(); return bothTablesData; }
source share