日期:2014-05-20 浏览次数:20911 次
query = from p in db.OlProduct
join sku in db.SKU.DefaultIfEmpty() on p.SkuID equals sku.Id into pSku
from pg in pSku.DefaultIfEmpty()
where
p.SKU.Contains(strSearchWord) ||
pg.PackageSKU.Any(g => g.SKU1.SKU1.Contains(strSearchWord)) ||
pg.PackageSKU1.Any(g => g.SKU.SKU1.Contains(strSearchWord)) ||
pg.SKU1.Contains(strSearchWord)
select p;
SELECT *
FROM [dbo].[OlProduct] AS [t0]
LEFT OUTER JOIN ((
SELECT NULL AS [EMPTY]
) AS [t1]
LEFT OUTER JOIN [dbo].[SKU] AS [t2] ON 1=1 ) ON [t0].[SkuID] = ([t2].[Id])
WHERE (([t0].[SKU] LIKE @p0) OR (EXISTS(
SELECT NULL AS [EMPTY]
FROM [dbo].[PackageSKU] AS [t3]
INNER JOIN [dbo].[SKU] AS [t4] ON [t4].[Id] = [t3].[FSKUId]
WHERE ([t4].[SKU] LIKE @p1) AND ([t3].[CSKUId] = [t2].[Id])
)) OR (EXISTS(
SELECT NULL AS [EMPTY]
FROM [dbo].[PackageSKU] AS [t5]
INNER JOIN [dbo].[SKU] AS [t6] ON [t6].[Id] = [t5].[CSKUId]
WHERE ([t6].[SKU] LIKE @p2) AND ([t5].[FSKUId] = [t2].[Id])
)) OR ([t2].[SKU] LIKE @p3)) AND ([t0].[Cid] = @p4) AND ([t0].[EbayOnlineStatus] = @p5)
ORDER BY [t0].[Id] DESC
query = from p in db.OlProduct
join sku in db.SKU on p.SkuID equals sku.Id into pSku
from pg in pSku.DefaultIfEmpty()
where
p.SKU.Contains(strSearchWord)
------解决方案--------------------
(pg!=null && pg.PackageSKU.Any(g => g.SKU1.SKU1.Contains(strSearchWord)))
------解决方案--------------------
(pg!=null && pg.PackageSKU1.Any(g => g.SKU.SKU1.Contains(strSearchWord)))
------解决方案--------------------
(pg!=null && pg.SKU1.Contains(strSearchWord))
select p;