Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the Linq join data?

Shulou Source: shulou.com Published: 2022-06-02 09:00:46 10月04日 Update

This article mainly introduces "what is Linq join data". In daily operation, I believe many people have doubts about what Linq connection data is. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "what is Linq connection data?" Next, please follow the editor to study!

Linq join data (JOIN or GROUP JOIN):

You can combine multiple data sources into a From clause in several ways. The Join keyword is equivalent to INNER JOIN in SQL. It combines the two sets based on the matching key values between the elements in the two sets. For example: the following query for students whose last names begin with vowels:

Dim vowels () As String = {"A", "E", "I", "O", "U"} Dim vowelNames = From student In students, vowel In vowels _ Where student.Last.IndexOf (vowel) = 0 _ select Name = student.First & "" & _ student.Last, Initial = vowel _ Order By Initial

Or:

Dim vowelNames2 = From student In students _ Join vowel In vowels _ On student.Last (0) Equals vowel _ Select Name = student.First & "& _ student.Last, Initial = vowel _ Order By Initial

Linq join data is equivalent to LEFT OUTER JOIN in SQL, combining multiple collections into a single hierarchical collection.

You can use multiple Join clauses in a query to join two or more collections into a single collection.

Without using the Join clause, you can perform an implicit join to combine collections. To do this, include multiple In clauses in the From clause and specify the Where clause that identifies the key to be used for the join.

Full syntax:

Group Join element [As type] In collection _ On key1 Equals key2 [And key3 Equals key4 [...]] _ Into expressionList

Where expressionList is required and is one or more expressions that identify how groups of elements in the collection are aggregated. To identify a member name for the grouping result, use the Group keyword (= Group).

The Linq join data operation returns all the results in the collection identified to the left of the Linq join data operator. This is true even if there are no matches in the collection to be joined. This is similar to LEFT OUTER JOIN in SQL.

At this point, the study of "what is Linq join data" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Data clause multiple identification learning two more combination element key keyword single method result help query operation utility to this end next Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker NVidia Xiaomi Linux Microsoft