I need a column that will have the maximum occurances of a tag so the column will have the same value all the way down and also the minimum occurances of a tag all the way down here is my code it doesn't quite work the way I would like it to.
ALTER PROCEDURE dbo.sp_Blogs_GetTagCloudByBlog
(
@BlogID int
)
AS
SET NOCOUNT ON
SELECT sys_Objects_Tags.TagID, sys_Tags.TagName, COUNT(sys_Objects_Tags.TagID) Count
From sys_Objects_Tags
INNER JOIN sys_Tags ON
sys_Objects_Tags.TagID = sys_Tags.TagID
INNER JOIN (SELECT sys_Objects_Tags.TagID, COUNT(1)[MaxOccurances]
FROM sys_Objects_Tags
WHERE sys_Objects_Tags.SystemObjectID = @BlogID
GROUP BY sys_Objects_Tags.TagID
)MaxOccurances
ON MaxOccurances.TagID = sys_Objects_Tags.TagID
WHERE sys_Objects_Tags.SystemObjectID = @BlogID
AND sys_Objects_Tags.TableName = 'Blog'
GROUP BY sys_Objects_Tags.TagID, sys_Tags.TagName, MaxOccurances.TagID