Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

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


Group: General Forum Members
Last Login: Wednesday, August 12, 2015 3:04 PM
Points: 18, Visits: 113
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
left join b on =
left join d on
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