SQL Select subroutine help

  • I have this script which returns a single row but I need the tag count for that single result like a subroutine can somebody help me with statement please

    SELECT sys_Objects_Tags.TagID, sys_Tags.TagName,

    (SELECT COUNT(*)

    FROM sys_Objects_Tags

    INNER JOIN sys_Tags ON sys_Objects_Tags.TagID = sys_Tags.TagID

    WHERE sys_Objects_Tags.SystemObjectID = @BlogID

    GROUP BY sys_Objects_Tags.TagID, sys_Tags.TagName

    ) Count

    From sys_Objects_Tags

    INNER JOIN sys_Tags ON

    sys_Objects_Tags.TagID = sys_Tags.TagID

    WHERE sys_Objects_Tags.SystemObjectID = @BlogID AND

    sys_Objects_Tags.SystemObjectRecordID = @BlogEntryID

    AND sys_Objects_Tags.TableName = 'Blog'

    GROUP BY sys_Objects_Tags.TagID, sys_Tags.TagName

    The Count column is the part Im having trouble with can't do group by statement there

  • This was removed by the editor as SPAM

  • Yes thanks your code does work choice I would never of guessed it thanks heaps

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply