-1

我在 SQLCE 数据库上有 3 个关系表。

产品 ProductCategory ProductPhoto

---------- ---------------------- -----

PId CatId PhotoId

名称 名称 值

CatId PID

我需要,列出 ProductCategories 和 Linq 的第一张产品照片。
如果无法使用 Linq,请使用 sql 代码。
谢谢。

4

1 回答 1

1
from pc in ProductCategories
let photo = pc.Products.SelectMany(p => p.Photos).FirstOrDefault()
select new {pc, photo};
于 2012-05-23T15:15:30.350 回答