Categories
c# entity-framework linq sql

get all the children whose grandparent’s ID is equal to 1

I have three tables in database as follows:

1.Design_Master_ParentMenus
1.ParentMenuID 1--------
2.Title |
2.Design_Master_Categories |
1.CategoryID 1------|---------
2.Title | |
3.ParentMenuID *------ |
3.Design_Master_TileItem |
1.TileItemID |
2.Title |
3.CategoryID *---------------

Now I want to get all the Items from Master_Design_TileItem whose grandparent’s ParentMenuID is equal to 1.

So, far I have tried the below queries but I was not successful.

var g = from f in db.Design_Master_Categories
where f.CategoryID == 1
select f.CategoryID;
var v = from h in db.Design_Master_ParentMenus
where h.ParentMenuID == g.FirstOrDefault()
select h.ParentMenuID;
var result = from t in db.Design_Master_TileItem
join c in db.Design_Master_Categories
on t.CategoryID equals c.CategoryID
join p in db.Design_Master_ParentMenus
on c.ParentMenuID equals p.ParentMenuID
where p.ParentMenuID == v.FirstOrDefault()
select t;

But when I run the program I always get result = null.