Questions tagged «multiple-tables»


6
如何在LINQ Lambda中的多个表之间执行Join
我试图在LINQ中的多个表之间执行联接。我有以下课程: Product {Id, ProdName, ProdQty} Category {Id, CatName} ProductCategory{ProdId, CatId} //association table 我用下面的代码(其中product,category和productcategory是在上述类的实例): var query = product.Join(productcategory, p => p.Id, pc => pc.ProdID, (p, pc) => new {product = p, productcategory = pc}) .Join(category, ppc => ppc.productcategory.CatId, c => c.Id, (ppc, c) => new { productproductcategory = ppc, category = …

3
选择*从多个表。的MySQL
SELECT name, price, photo FROM drinks, drinks_photos WHERE drinks.id = drinks_id 产生5行(5个数组),photo是一行中唯一的唯一字段。name, price重复(在这里 fanta- name, price 重复3次。)我如何摆脱这些重复? 编辑: 我想要name, price和所有photo为每个饮料。 id name price 1. fanta 5 2. dew 4 id photo drinks_id 1. ./images/fanta-1.jpg 1 2. ./images/fanta-2.jpg 1 3. ./images/fanta-3.jpg 1 4. ./images/dew-1.jpg 2 5. ./images/dew-2.jpg 2
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.