-1
여기의 아이디어는 모든 레서피의 모든 재료를 합친 것입니다. 내 검색어입니다SQL에 대한 linq의 SQL 쿼리 (문제 별 그룹)
SELECT IngredientName,sum(Amount) as Amount,Unit
FROM RecipeIngredients Join Ingredients ON RecipeIngredients.IngredientID = Ingredients.IngredientsID
GROUP BY IngredientID,IngredientName,Unit
ORDER BY IngredientName
훌륭한 작품입니다. 문제 없음. 나는 linq SQL 구문으로 혼란스러워지고있다. 이것은 내가 지금까지 가지고있는 것입니다.
using (lDataContext db = new lDataContext())
{
return (from ri in db.RecipeIngredients join i in db.Ingredients on ri.IngredientID equals i.IngredientsID
group new {ri,i} by new {i.IngredientsID,i.IngredientName,ri.Unit }
into table
select new {
Name = table.IngredientName
Unit = table.Unit
Amount = table.Sum(i.amount) }
).ToList();
}
내 구문으로 도움을받을 수 있습니까?
예제로 그룹을 찾고 설명서를 읽으셨습니까? 이게 쉬운 일인 것 같아요.이 물건을 보면서 더 많은 것을 배울 수 있습니다. –
설명서는 어디에 있습니까? –
예를 들어 검색 기능이 있으며 Google에 설명서가 있습니다. –