I have three tables A
, B
and C
. C
has many B
's which has many A
's.
I want to display all this data in a tree so I bound db.A
to my nested control which had a three layer hierarchy. The only problem is I get too many rows because it's not doing an inner join between B
and C
.
So how can I do something like this in linq:
SELECT A.name, B.name
FROM A
INNER JOIN B ON A.id = B.AID
INNER JOIN C ON B.id = C.BID
GROUP BY A.Name, B.Name
ORDER BY A.Name
I've tried the following to no avail:
from a in A
join b in B on a.id equals b.AID
join c in C on b.id equals c.BID
select c
Many thanks