In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how Linq implements Left join. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
There is no left join in linq, so it will be more difficult when you want to use it. Here is how linq implements Left join.
There are fields in the students table. The No,Name.book table has bookName,borroeStudentNo (borrower's number). Now you need to get all the book information, including the borrower's information. Left join is needed here.
Var sqlresult = from b in book joins in students on b.borroeStudentNoequalss.No intobs from bb in bs.DefaultIfEmpty () select new {b.bookName, s.No, s.Name}
* linq implements Left join
Recently, a problem has been found that when the query source is two List, the above method will report an error when the result on the right is empty. That is, when the borrower of the above book is empty. Emphasize: when querying sources are two List, not data tables
Change to:
Select new {b.bookName, SNo = s==null? "": s.No, SName = s==null? "": s.Name}; after reading the above, do you have any further understanding of how Linq implements Left join? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.