SQL ORDER BY weirdness
SELECT * FROM Topics
WHERE (ForumID = @ForumdID) AND ((LastPostTime > @TimeSpan) OR (Pinned = 1))
ORDER BY Pinned DESC, LastPostTime DESC
To populate the cursor, prior to the paging and such, my sproc uses this:
SELECT TopicID FROM Topics
WHERE ForumID = @ForumID
ORDER BY Pinned DESC, LastPostTime DESC
For some likely obvious reason I'm missing, it doesn't do the ordering for the Pinned column, which is a bit. Pinned topics should come first.
Tell me what I'm missing, and you get a free copy of the forums! ;)