Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Linq with multiple joins and group by Expand / Collapse
Author
Message
Posted Thursday, February 14, 2013 8:33 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, December 12, 2014 1:27 PM
Points: 18, Visits: 106
Have any of you worked on converting a SQL query with multiple joins and group by multiple columns

I am trying to convert the following into VB.NET LINQ to dataset

 select a.a1, Sum(b.b1 * c.Q) [V_QTY], c.c1, a.a2 , b.b2,d.d1, d.d3, e.e1, c.c2, c.c3
from a
join (select id, a as c1,b as c2, count(num) Q, c as c3, d as c4
from abc
where a=1 and id=3723
group by a, b, c, d) c on a.id= h.id
left join b on b.id = c.id
left join d on d.id= d.id
where c.a= 1
group by select a.a1, c.c1, a.a2 , b.b2,d.d1, d.d3 , c.c2, c.c3
order by c.c1, c.c2, b.b2

Since i have a nested join and i am grouping at both levels it is proving to be a bit awkward. I am also getting familiar with LINQ to dataset. Any help would be appreciated.
Post #1420122
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse