如何在LINQ中编写查询对于以下场景

时间:2014-01-16 11:05:27

标签: c# linq linq-to-sql

如何在sql中将不等于运算符写入linq

select A.ID,B.TestName  from sampleTable A join TestTable b on A.ID<>B.ID. 

3 个答案:

答案 0 :(得分:0)

尝试!= operator这个:

select A.ID,B.TestName  from sampleTable A join TestTable b on A.ID!=B.ID. 

答案 1 :(得分:0)

尝试!=-Operator(不等运算符)

 ... join TestTable B on A.ID != B.ID

答案 2 :(得分:0)

var result = from a in context.sampleTable 
             join b in context.TestTable on a.ID != b.ID
             select new { a.ID, b.TestName }