using count in a partition query

  • SELECT BloggerName,Topic,[Year],Total,

    Rank() OVER (Partition by BloggerName Order by Total DESC) as ‘Ranking’

    FROM

    BlogCount

    If i need to count the bloggername by Count() function how would i do it.....can any one please help me.....my query looks very similar to this....

  • SELECT BloggerName,Topic,[Year],Total,count(*)

    FROM

    BlogCount

    group by BloggerName,Topic,[Year],Total

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • If Bhuvnesh's solution does not work, please provide us a better example of what you are trying to do. Include sample data and table structure. See the article in my signature line for help on creating a helpful thread.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • SELECT BloggerName,Topic,[Year],Total,

    Rank() OVER (Partition by BloggerName Order by Total DESC) as 'Ranking',

    COUNT(*) OVER(PARTITION BY BloggerName) AS BloggerNameCount

    FROM BlogCount;

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537

Viewing 4 posts - 1 through 4 (of 4 total)

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