Created
August 24, 2009 11:20
-
-
Save pcdinh/173823 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH PostList AS ( | |
SELECT row_number() OVER (ORDER BY p.PostID DESC) Row, | |
p.PostID, p.ThreadID, p.ParentID, p.SortOrder, | |
p.PostDate, p.Subject, p.SectionID ForumID, p.PostAuthor UserName, | |
p.UserID UserID, p.IPAddress, t.ThreadDate, cast(p.[Body] as text) Body | |
FROM cs_Posts p | |
INNER JOIN cs_Threads t ON t.ThreadID = p.ThreadID | |
INNER JOIN cs_Sections s ON s.SectionID = p.SectionID | |
WHERE s.ApplicationType = 0 | |
) | |
SELECT * | |
FROM PostList | |
WHERE Row BETWEEN 0 AND 300 | |
ORDER BY PostID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment