LINQ to SQL: how to handle ambiguous column names when joining tables?

I'm going to download this question from a previous question I asked:
LINQ to SQL: multiple joins in multiple columns. Is it possible?

So, I have a LINQ query:

var query =
    from t1 in myTABLE1List // List<TABLE_1>
    join t2 in myTABLE1List
      on new { t1.ColumnA, t1.ColumnB } equals new { t2.ColumnA, t2.ColumnB }
    join t3 in myTABLE1List
      on new { t2.ColumnA, t2.ColumnB } equals new { t3.ColumnA, t3.ColumnB }
  select new {t1.ColumnA, t2.ColumnA, t3.ColumnA } // Duplicate Anon type 'ColumnA'

How can i solve this?

+3
source share
1 answer

When explicitly naming an anonymous type

select new {t1A = t1.ColumnA, t2A = t2.ColumnA, t3A = t3.ColumnA } 
+6
source

All Articles