1

I have the following query

Dim query As IEnumerable(Of IEnumerable(Of DataRow)) = 
                (From veh In  Vehicles.AsEnumerable
                 Group Join auctioned In ActiveAuctionedVehicles.AsEnumerable
                 On veh.Field(Of Decimal)("VehicleId") Equals auctioned.Field(Of String)("VehicleId")
                 Into Group
                 Let auctioned = Group.FirstOrDefault
                 Where auctioned IsNot Nothing AndAlso auctioned.Field(Of String)("Bundle") = bundle
                 Select Group)

Where Vehicles and ActiveAuctionedVehicles are DataTables.

If i Select Group or Select veh, auctioned the result is IEnumerable(Of IEnumerable(Of DataRow)). On the other hand, selecting only one of the veh, auctioned returns IEnumerable(Of DataRow)

In the first case the first enumerable contains only one record, which by turn contains the datarow.

Why is this happening?

TYY
  • 2,702
  • 1
  • 13
  • 14
Mitsosp
  • 399
  • 3
  • 17
  • As an aside, if you set `Option Strict On` you cannot use `veh.Field(Of Decimal)("VehicleId") Equals auctioned.Field(Of String)("VehicleId")` either. – Tim Schmelter Mar 26 '15 at 09:50
  • 1
    If you select a group of rows, why do you expect that you get `IEnumerable(Of DataRow)`? You could use `Select Group.First()` if you want. – Tim Schmelter Mar 26 '15 at 09:52
  • Thanks, it seems that my understanding of Group Join was completely wrong. I couldn't find a way to get the joined result set, and after searching through the web, i came to the wrong conclusion that group join was the right way to do it. So i guess there is no SQL Join equivalent, is there? – Mitsosp Mar 26 '15 at 17:15
  • 1
    http://stackoverflow.com/q/17968469/861716 – Gert Arnold Mar 26 '15 at 21:52

0 Answers0