对于使用OR-joins的SQL查询,Linq等效于什么?

时间:2017-04-19 07:55:05

标签: c# linq

我在Linq Join中需要多个条件。

可能相当于

select * 
from tblOfferingBillingBehaviorMapping billMap
inner join tblLookUpBillingBehavior lkpBill 
    on (billMap.LkpBillingBehaviorId =lkpBill.LkpBillingBehaviorId 
        or billMap.LkpBillingBehaviorId =lkpBill.ParentRootId) 

2 个答案:

答案 0 :(得分:1)

var query = from [record] in [table]
                        join [table that you join] 
                        in [name of the table] 
                        on [record] equals [record in the other table]
                        select new { [Column Name] = [Table].[Record] };

如果使用查询,可以这样做。 我不知道如何在linq p =>中执行该操作。页。样式。 希望这是有帮助的。 这是一个例子:

var query = from person in people
                        join pet in pets on person equals pet.Owner
                        select new { OwnerName = person.FirstName, PetName = pet.Name };

答案 1 :(得分:0)

您也可以使用类似于内连接条件的where条件进行交叉连接

class mainStreamListener(tweepy.StreamListener):
    def on_data(self, status):
        #SOME CODE HERE
        id = status.id_str #Get the status ID
        api.retweet(id) #Retweet the status by providing its ID
    def on_error(self, status_code):
        #SOME CODE HERE