Select distinct b.contributor, blogaddress,cou nt(b.contentid) RecipeCount,isn ull(c.cnt,0) Other
from weblogs.dbo.blo gentries b left outer join (select contributor , count(*) cnt from weblogs.dbo.blo gentries where category='food' and subcategory = 'others' group by contributor) c
on b.contributor = c.contributor
where category='food' and subcategory<>'o thers' and destid>0
group by b.contributor,b logaddress,cnt
When I execute the above query I get the below given output which is correct as per the data
Contributor Baseaddress Recipecnt others
Uma Balakumar umabalakumar.su lekha.com 81 0
Uma Shogalingam umashogalingam. sulekha.com 136 1
umaudayshanker umaudayshanker. sulekha.com 1 0
umpc umpc.sulekha.co m 2 1
uropinion uropinion.sulek ha.com 0 0
ushasuryamani ushasuryamani.s ulekha.com 19 2
I want an sql query which will display the top bloggers, sorting the output data in the descending order. The result should be displayed as:
Uma Shogalingam umashogalingam. sulekha.com 136 1
Uma Balakumar umabalakumar.su lekha.com 81 0
ushasuryamani ushasuryamani.s ulekha.com 19 2
umpc umpc.sulekha.co m 2 1
umaudayshanker umaudayshanker. sulekha.com 1 0
uropinion uropinion.sulek ha.com 0 0
from weblogs.dbo.blo gentries b left outer join (select contributor , count(*) cnt from weblogs.dbo.blo gentries where category='food' and subcategory = 'others' group by contributor) c
on b.contributor = c.contributor
where category='food' and subcategory<>'o thers' and destid>0
group by b.contributor,b logaddress,cnt
When I execute the above query I get the below given output which is correct as per the data
Contributor Baseaddress Recipecnt others
Uma Balakumar umabalakumar.su lekha.com 81 0
Uma Shogalingam umashogalingam. sulekha.com 136 1
umaudayshanker umaudayshanker. sulekha.com 1 0
umpc umpc.sulekha.co m 2 1
uropinion uropinion.sulek ha.com 0 0
ushasuryamani ushasuryamani.s ulekha.com 19 2
I want an sql query which will display the top bloggers, sorting the output data in the descending order. The result should be displayed as:
Uma Shogalingam umashogalingam. sulekha.com 136 1
Uma Balakumar umabalakumar.su lekha.com 81 0
ushasuryamani ushasuryamani.s ulekha.com 19 2
umpc umpc.sulekha.co m 2 1
umaudayshanker umaudayshanker. sulekha.com 1 0
uropinion uropinion.sulek ha.com 0 0
Comment