1
DECLARE @TotalQuestions int;
DECLARE @CorrectQuestions int;
DECLARE @IncorrectQuestions int;
SELECT (
SET CorrectQuestion = SELECT COUNT(WiningComment)
FROM Threads
WHERE WiningComment IN (SELECT CommentsID
FROM Comments
WHERE [email protected])
) as 'WinningAnswers',
(
SET TotalQuestions = SELECT COUNT(CommentsID)
FROM Comments
WHERE [email protected]
) as 'TotalAnswers'
(
SELECT (TotalQuestions-CorrectQuestions) //I am not sure about this part!!
) as 'IncorrectQuestions'
我不知道最後一部分減去的結果幫幫忙,我想從另一個子查詢我需要從兩個查詢
我認爲這是正確的答案..一半測試它.. – WithFlyingColors