70-564 Free Dumps Study Materials
Question 15: You are creating an ASP.NET application by using the .NET Framework 3.5.
You use LINQ to SQL to query a SQL Server database. You need to create a LINQ query to retrieve
information on order and order details.
You need to ensure that the LINQ query executes the following SQL statement:
SELECT Order.OrderID,Order.Description,OrderDetails.UnitPrice
FROM Order JOIN OrderDetails
ON Order.OrderID = OrderDetails.OrderID
Which LINQ query should you use?
A. From order In db.Orders _
Join details In db.OrderDetails On _
order.OrderID Equals details.OrderID _
Select _
order.OrderID, _
order.Description, _
details.UnitPrice
B. From order In db.Orders _
Group Join details In db.OrderDetails On _
order.OrderID Equals details.OrderID Into grp = Group _
From ord In grp.DefaultIfEmpty() _
Select _
order.OrderID, _
order.Description, _
ord.UnitPrice
C. From order In db.Orders _
Group Join details In db.OrderDetails On _
order.OrderID Equals details.OrderID Into grp = Group _
Select _
order.OrderID, _
order.Description, _
grp.First().UnitPrice
D. From order In db.Orders _
Group Join details In db.OrderDetails On _
order.OrderID Equals details.OrderID Into grp = Group _
Let price = grp.DefaultIfEmpty().First() _
Select _
order.OrderID, _
order.Description, _
price.UnitPrice
Correct Answer: A