开发者

Link To SQL Join Statement with or Clause

开发者 https://www.devze.com 2022-12-22 06:53 出处:网络
I have to following SQL Statement that I want to conver to LINQ Select F.FooName B.BarName From Foo F Inner Join Bar B on B.BarName = F.FooName OR B.BarName + \'hello\' = F.FooName

I have to following SQL Statement that I want to conver to LINQ

Select
  F.FooName
  B.BarName
From Foo F
Inner Join Bar B on B.BarName = F.FooName OR B.BarName + 'hello' = F.FooName

I have seen Inner joins in Link on multiple conditions with AND Clauses but not using OR The following is as far as I have gotten

var myresult = from f in Foo
               join b in Bar
                   on new {Name = B.BarName开发者_JAVA技巧, NamePlus = B.BarName + "hello"} equals
                      new {Name = F.FooName, NamePlus = F.FooName}
               select new { f, b }

Clearly this is not right. Can anyone Help?


var myresult = from f in foo
               from b in bar
               where b.BarName == f.FooName ||
                     b.BarName + 'hello' == F.FooName
               select new {f, b}; 
0

精彩评论

暂无评论...
验证码 换一张
取 消