4

I'm going to bootstrap this question with a previous one I asked:
LINQ to SQL: Multiple joins ON multiple Columns. Is this 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 resolve this?

Community
  • 1
  • 1
aarona
  • 35,986
  • 41
  • 138
  • 186
  • 3
    It will be a little redundant since all `ColumnA` will be equal because of the joins. – Albin Sunnanbo Mar 15 '11 at 09:15
  • @Albin, ah yes you are right. This is just an example though. the columns I'm dealing with are not in the joins so they aren't necessarily equal. – aarona Mar 15 '11 at 18:28

1 Answers1

8

With explicit naming of the properties of the anonymous type

select new {t1A = t1.ColumnA, t2A = t2.ColumnA, t3A = t3.ColumnA } 
Albin Sunnanbo
  • 46,430
  • 8
  • 69
  • 108