1

私はdbを単純化するつもりです。
外観は次のとおりです。

テーブル:

Main: Products: ID, Ref, Price, 
Translation: ID, Product_ID, Language_ID, Name
Images: ID, Product_ID, Path, Index

私はlinqの初心者で、すべての製品、language_ID = 1の名前、Index = 1の画像を取得しようとしました

From p In db.Products 
Join t In db.Translate_Products On p.ID_Product Equals t.Product_ID 
Join i In db.Images On p.ID_Product Equals i.Product_ID 
Where t.Language_ID = 1 And i.Index= 0 
Select p, t, i
4

2 に答える 2

2
From p In db.Products 
Join t In db.Translate_Products On p.ID_Product equals t.Product_ID into results1
from r1 in results.DefaultIfEmpty()
Join i In db.Images On p.ID_Product equals i.Product_ID 
into results2
from r2 in results2.DefaultIfEmpty()
Where results.Language_ID = 1 And i.Index= 0 
Select new
{

Productid = p.Productid,
..
..
..
}
于 2012-04-19T14:01:05.700 に答える
0
From p In db.Products 
Join t In db.Translate_Products On p.ID_Product equals t.Product_ID 
into results1
from r1 in results1.DefaultIfEmpty()
Join i In db.Images On p.ID_Product equals i.Product_ID     
Where t.Language_ID == 1 And i.Index== 0 
Select new
{

Productid = p.Productid,
..
..
..
}
于 2012-04-20T09:41:51.203 に答える