Hello,
Try the following query:
Code: |
DELETE FROM #__ariquizquestionversion WHERE QuestionVersionId IN (
SELECT
*
FROM (
SELECT
DISTINCT QV.QuestionVersionId
FROM
#__ariquizquestionversion QV INNER JOIN #__ariquizquestion QB
ON QV.QuestionId = QB.QuestionId
LEFT JOIN #__ariquizquestion Q
ON QV.QuestionVersionId = Q.QuestionVersionId
LEFT JOIN #__ariquizstatistics S
ON QV.QuestionVersionId = S.QuestionVersionId
WHERE QB.QuizId <> 0 AND Q.QuestionId IS NULL AND S.StatisticsId IS NULL
) T
)
|
PS: Create a backup before executing the query.
Regards,
ARI Soft