Demo for 11140169

0

Please login or register to vote for this query.

(click on this box to dismiss)

Latin Language

Q&A for linguists, teachers, and students wanting to discuss the finer points of the Latin language

SELECT
* 
FROM
(SELECT 
    T.TagName,
    Year(a.creationDate) yr,
     CASE WHEN (GROUPING(Substring(DateName(m,a.creationDate),1,3)) = 1) THEN 'Total'
          ELSE Substring(DateName(m,a.creationDate),1,3)  
      END mh ,
    SUM(a.score) Score
FROM
  Posts a
  INNER JOIN Posts q
  ON a.ParentID = q.id
  INNER JOIN postTags pt 
  ON q.id = pt.PostId
  INNER JOIN Tags t
  ON Pt.TagiD = t.id
  WHERE a.owneruserID = ##UserID##
 
  
GROUP BY
    t.TagName,
    Year(a.creationDate) ,
    Substring(DateName(m,a.creationDate),1,3) 
    WITH ROLLUP
HAVING 
GROUPING (Year(a.creationDate))  = 0
    ) SourceTable
PIVOT
(
sum( Score )
FOR mh IN ([Jan],[Feb],[Mar],[Apr],[May],[Jun],[Jul],[Aug],[Sep],[Oct],[Nov],[Dec], [Total])
) AS PivotTable

Enter Parameters

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