Skip to content

Instantly share code, notes, and snippets.

@mikebuchanon
Created December 13, 2013 14:53
Show Gist options
  • Save mikebuchanon/7945431 to your computer and use it in GitHub Desktop.
Save mikebuchanon/7945431 to your computer and use it in GitHub Desktop.
Find ANGEL courses with deleted forum posts based on semester
SELECT c.COURSE_ID,
lo2.TITLE [folder], lo.TITLE [forum_name],
dp.AuthorDisplayName,
dp.Subject,
CASE
WHEN dp.PostLevel = 0 THEN 'Post'
ELSE 'Reply'
END [post_type]
FROM DiscussionPost dp (nolock)
JOIN DiscussionForum df (nolock) ON df.ForumId=dp.ForumId
JOIN LSN_ENTRIES le (nolock) ON le.ENTRY_ID=df.EntryId
JOIN LSN_OBJECTS lo (nolock) ON lo.OBJECT_ID=le.OBJECT_ID
JOIN LSN_ENTRIES le2 (nolock) ON le2.ENTRY_ID=le.PARENT_ID
JOIN LSN_OBJECTS lo2 (nolock) ON lo2.OBJECT_ID=le2.OBJECT_ID
JOIN COURSES c (nolock) ON c.COURSE_ID=le.COURSE_ID
WHERE c.SEMESTER = 'SEMESTER'
AND dp.DeletedCount > 0
ORDER BY c.COURSE_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment