vb.net - Linq nested Join from a group join if null -


i'm sure simple life of me cannot find single example of this.

i doing group join on table want second join on grouped join.

table 1 orders table 2 contacts table 3 phone numbers

dim query = order in orders _ group join contact in contacts on order.contactid equals contact.contactid grpcontacts = group gcontact in grpcontacts.defaultifempty() group join phone in phonenumbers on phone.phonenumberid equals gcontact.homephoneid grpphonenumbers = group gphone in grpphonenumbers.defaultifempty() 

this query error out on last join when gcontact null. makes sense... how do join anyway , have null/nothing values if record not exist?

update resolved * if else runs can add expression after on operator determine if previous group join nothing. moander!

dim query = order in orders _ group join contact in contacts on order.contactid equals contact.contactid grpcontacts = group gcontact in grpcontacts.defaultifempty() group join phone in phonenumbers on if(phone nothing, 0, phone.phonenumberid) equals gcontact.homephoneid grpphonenumbers = group gphone in grpphonenumbers.defaultifempty() 

try using iif avoid accessing gcontact when null:

equals iif(gcontact nothing, 0, gcontact.homephoneid) 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -