0
我的SQL查詢如下。子頂部1和多於等於使用Linq的子查詢
select st.kProductVersionPlatformFrom, st.kProductVersionPlatformTo, pv.kProduct, pv.nId, *
from vSysTable st
left join vProductVersion pv on st.kProductVersionPlatformFrom = pv.nId
where
st.kProductVersionPlatformTo >= (select top 1 nid from vProductVersion where kProduct = 2
and kProductVersionPlatform = 87 order by nId desc)
我試圖將其轉換爲LINQ的,但無法找到的方式來使用大於等於
var systemTableList = (from sysTableEntity in _sysTableEntityRepository.AsQueryable()
join versionEntity in _productVersionRepository.AsQueryable() on
sysTableEntity.ProductVersionPlatformFrom equals versionEntity.Id
into leftjoined
from joinedsysVersionTable in leftjoined.DefaultIfEmpty()
where (from versionEntity in _productVersionRepository.AsQueryable()
where versionEntity.ProductEntityId.Equals(2) &&
versionEntity.PlatformProductVersionEntityId.Equals(87)
orderby versionEntity.Id descending
select versionEntity.Id).Take(1).Contains(sysTableEntity.ProductVersionPlatformFrom >= 87)
select new { sysTableEntity});
但它給我的錯誤附近的包含關鍵字的「之類的說法無法推斷用法「
這裏用什麼來代替包含?我也嘗試使用但仍然無法使用。
如果它所返回null? – DevelopmentIsMyPassion 2013-03-12 11:33:41
如果top 1查詢返回null,該怎麼辦? – DevelopmentIsMyPassion 2013-03-12 11:46:10
@AshReva你必須告訴我。 – 2013-03-12 11:51:13