Pivot on WeekDay Example


Please login or register to vote for this query.

(click on this box to dismiss)

Constructed Languages

Q&A for designers and users of artificial or invented languages, consciously developed instead of having developed naturally

SELECT owneruserid [User Link], [Saturday], [Sunday],[Monday],
       [Tuesday], [Wednesday], [Thursday], [Friday]
FROM   (SELECT score, 
               Datename(weekday, creationdate) DAY 
        FROM   posts 
        WHERE  owneruserid IN ( 1, 2, 3, 4, 5 )) p PIVOT ( SUM (score ) FOR DAY 
       IN ( 
       [Saturday], [Sunday], [Monday], [Tuesday], [Wednesday], [Thursday], [Friday]) ) pvt

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results