Created
February 11, 2013 20:10
-
-
Save laribee/4757189 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| SELECT TOP (100) PERCENT dbo.Forum.ID AS ForumID | |
| , I.ID AS IdeaID | |
| , (SELECT COUNT(*) FROM dbo.Vote WHERE (Idea_id = I.ID)) AS VoteCount | |
| , (SELECT COUNT(*) FROM dbo.Comment WHERE (Idea_id = I.ID)) AS CommentCount | |
| FROM dbo.Idea AS I | |
| INNER JOIN dbo.Category ON I.Category_id = dbo.Category.ID | |
| INNER JOIN dbo.Forum ON dbo.Category.Forum_id = dbo.Forum.ID | |
| GROUP BY I.ID, dbo.Forum.ID | |
| ORDER BY ForumID, IdeaID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment