Select CoalESCE((select VoteTypes.name from VoteTypes whe...

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

Select
CoalESCE((select VoteTypes.name from VoteTypes where votetypes.id=resQ.voteTypeId), 'N/A') as
voteTypeName
,resQ.counter as uniquePosts
from (
select
Votes.VoteTypeId
,count(distinct posts.Id) as counter
from posts
left join Votes on Votes.PostId=Posts.Id
group by votes.voteTypeId) as resQ
order by 2 desc

--coalsce - returns first non NULL value from the list
--

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results