Left Join Linq to Entity's Vb.net -
i can't figure out linq entity query syntax. problem if value of calls table null noting comes up, want make left join 'all' rows calls table.
i tried group can't figure out correct way write it.
dim ticketquery objectquery = c in endata.customer _ join t in endata.calls on t.customerid equals c.customerid _ join status in endata.lists on t.status equals status.listvalue _ join project in endata.lists on t.project equals project.listvalue _ join priorty in endata.lists on t.priority equals priorty.listvalue _ c.status > -1 , t.status > -1 , status.listtype = 1 , project.listtype = 3 , priorty.listtype = 2 _ select new {c.custname, t.callid, t.calldate, t.calltime, t.description, key .status = status.listtext, key .project = project.listtext, t.datemodified, key .priority = priorty.listtext} how can fix that?
similar question: linq sql: multiple left outer joins
microsoft documentation: http://msdn.microsoft.com/en-us/library/bb918093.aspx#y916
linq examples from: http://msdn.microsoft.com/en-us/vbasic/bb737909
left outer join so-called outer join can expressed group join. left outer joinis cross join, except left hand side elements included @ least once, if don't match right hand side elements. note how vegetables shows in output though has no matching products.
public sub linq105() dim categories() = {"beverages", "condiments", "vegetables", "dairy products", "seafood"} dim productlist = getproductlist() dim query = c in categories _ group join p in productlist on c equals p.category group _ p in group.defaultifempty() _ select category = c, productname = if(p nothing, "(no products)", p.productname) each v in query console.writeline(v.productname + ": " + v.category) next end sub
Comments
Post a Comment