linq to sql: join multiple columns from the same table

前端 未结 5 1810
有刺的猬
有刺的猬 2020-12-06 00:58

How do I inner join multiple columns from the same tables via Linq?

For example: I already have this...

join c in db.table2 on table2.ID equals tab         


        
5条回答
  •  长情又很酷
    2020-12-06 01:30

    You can put your query inside a Where clause instead of using the join operator.

    The join operator supports multiple clauses in VB.NET, but not C#.

    Alternatively, you can use the ANSI-82 style of 'SQL' syntax, e.g.:

    from t1 in table1
    from t2 in table1
    where t1.x == t2.x
    && t1.y == t2.y
    

提交回复
热议问题