Testing

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

select a.Years,a.Score, a.QuestionsCount,
(a.QuestionsCount/cast(343101  as float))*100 as percentage,
cast(round((a.QuestionsCount/cast(343101  as float)*100 ),2) as NUMERIC(15,2)) percentageRound,
cast(a.QuestionsCount as varchar(20))+ CHAR(13) + CHAR(10) +'(' 
+cast( cast(round((a.QuestionsCount/cast(343101  as float)*100 ),2) as NUMERIC(15,2))   as varchar(20))+
'%)' StringPercentatge  
from (
select datepart(year,creationdate) Years,Score='Negative_Scored_Questions', count(*) QuestionsCount
from posts 
where posttypeid = 1 and score < 0 and datepart(year,creationdate) = 2009
group by datepart(year,creationdate) 
--order by datepart(year,creationdate)
union 

select datepart(year,creationdate) Years,Score='Positive_Scored_Questions', count(*) QuestionsCount  
from posts 
where posttypeid = 1 and score > 0 and datepart(year,creationdate) = 2009
group by datepart(year,creationdate) 
--order by datepart(year,creationdate)
union 

select datepart(year,creationdate) Years,Score='Zero_Scored_Questions', count(*) QuestionsCount
from posts 
where posttypeid = 1 and score = 0 and datepart(year,creationdate) = 2009
group by datepart(year,creationdate) 
--order by datepart(year,creationdate)
) a 
group by a.Years,a.Score,a.QuestionsCount

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results