我怎麼可以這樣寫在LINQ:在LINQ查詢需要幫助的左外連接
SELECT
T.TestId,
S.SubjectName+' >> '+T.TestName +' ('+ CONVERT(VARCHAR(10),COUNT(Q.TestId)) +')' TestData
FROM
Test T LEFT OUTER JOIN Subject S
ON T.SubjectId = S.SubjectId
LEFT OUTER JOIN Quest Q
ON T.TestId = Q.TestId
GROUP BY
Q.TestId,
T.TestId,
T.TestName,
S.SubjectName
ORDER BY
COUNT(Q.TestId) DESC
書面左外的LINQ加入&集團通過需要幫助。
案例二:
SELECT
S.SubjectName,
T.TestName,
Q.Question,
A.Answer,
A.IsCorrect
FROM Ans A
INNER JOIN Quest Q
ON A.QuestId = Q.QuestId
AND A.QuestId IN (SELECT
Q.QuestId
FROM Quest Q
INNER JOIN Test T
ON Q.TestId = T.TestId)
INNER JOIN Subject S
ON A.SubjectId = S.SubjectId
INNER JOIN Test T
ON A.TestId = T.TestId
感謝。