tags:

views:

58

answers:

1

Need vb.net conversion of the below: orginal question at LINQ To SQL "Group By"

from S in SERVER
join H in SERVERHDD on S.Server_ID equals H.Server_ID
join FILTER in 
(from s in SERVERHDD group s 
        by new {s.Server_ID, s.Letter} 
        into groupedServerHDD select new 
                {
                        SERVERHDD_ID = groupedServer.Sum(gS=>gS.ServerHDD_ID)
                }
)
 on H.ServerHDD_ID equals FILTER.SERVERHDD_ID 
 orderby S.Hostname, H.Letter
 select S

Thanks in Advance.

A: 

From http://www.developerfusion.com/tools/convert/csharp-to-vb/ and untested.

Dim x = From S In SERVER _
    Join H In SERVERHDD On S.Server_ID = H.Server_ID _
    Join FILTER In (From s In SERVERHDD _
        Group s By New ()IntogroupedServerHDD _
        Select New ()) On H.ServerHDD_ID = FILTER.SERVERHDD_ID _
    Order By S.Hostname, H.Letter _
    Select S
Matthew Flaschen
Thank Mathew for guidance: Got this solved as :Dim query = From S In db.SERVERs _ Join H In db.SERVERHDDs On S.Server_ID = H.Server_ID _ Join FILTER In (From s In db.SERVERHDDs _ Group s By s.Server_ID, s.Letter _ Into ServerHDD_Ids = Sum(s.ServerHDD_ID) Order By ServerHDD_Ids Ascending) _ On H.ServerHDD_ID = FILTER.SERVERHDD_ID _ Order By S.Hostname, H.Letter _ Select S
Nev_Rahd
@Nev_Rahd: you might want to edit your post and add the solved solution below your question. It's a lot easier to read with proper code syntax highlight.
alextansc