1. Đinh nghĩa
Class Customer
Public CustomerID As Integer?
Public ContactName As String
Public Phone As String
Public Address As String
Public City As String
Public State As String
Public Zip As String
End Class
Class Order
Public OrderID As Integer?
Public CustomerID As Integer?
Public Cost As Single?
Public Phone As String
Public OrderDate As DateTime?
Public ShippingZip As String
Public ItemName As String
End Class
2. Chuyền kết quả
Dim CustomerTable As Customer() = { _
New Customer With {.ContactName = "Bill Horst", .CustomerID = 112}, _
New Customer With {.ContactName = "John Doe", .CustomerID = 354}, _
New Customer With {.ContactName = "Jane Doe", .CustomerID = 938}}
Dim OrderTable As Order() = { _
New Order With {.OrderDate = #3/25/1982#, .CustomerID = 112}, _
New Order With {.OrderDate = #3/13/2005#, .CustomerID = 112}, _
New Order With {.OrderDate = #9/29/2007#, .CustomerID = 938}, _
New Order With {.OrderDate = #1/31/2008#, .CustomerID = 444}}
3. Kết quả join left
SQL
| ||
SELECT Contact.ContactName, Shipment.OrderDate
FROM CustomerTable Contact
LEFT OUTER JOIN OrderTable Shipment
ON Contact.CustomerID = Shipment.CustomerID
|
LinkQ
VB
| ||||||||
From Contact In CustomerTable _
Group Join Shipment In OrderTable _
On Contact.CustomerID Equals Shipment.CustomerID _
Into RightTableResults = Group
Results:
{Contact={Customer}, RightTableResults = {Grouping}}
{Contact={Customer}, RightTableResults = {Order[]}}
{Contact={Customer}, RightTableResults = {Grouping}}
|
No comments:
Post a Comment