0
這裏是SQL查詢,,,我有兩個tables, one is Categories and other Sub Categories
,,,我想用inner query(Category table) and that value pass to outer query(Sub categories table)
如何用lambda表達式將它轉換爲Entity框架..?使用Lambda語法將SQL子查詢轉換爲EF查詢
select *
from DC_System_SubCategories
where CatID = (select max(CatID)
from DC_System_Categories)
如果'CatId'不是唯一的,並且您想要所有匹配:'var q = DC_System_SubCategories.Where(x => x.CatID == DC_System_SubCategories .Max(p => p.CatID));' – Magnus
這是一個更好的轉換....編輯。 –
謝謝sir .............但是我想從Categories表中獲取Max id,然後將它傳遞給Subcategories表 –