У меня есть SQL-запрос следующим образом:
SELECT
EVENTTYPEDESCRIPTION,
YEAR(EVENTSTARTDATE) as 'EVENTYEAR',
COUNT(PARTICIPANTID) AS 'TOTALPARTICIPANTS'
FROM WEBPROGRAMPARTICIPANTS
INNER JOIN WEBPROGRAMS
ON WEBPROGRAMPARTICIPANTS.PROGRAMCODE = WEBPROGRAMS.PROGRAMCODE
INNER JOIN WEBEVENTS
ON WEBPROGRAMS.PROGRAMID = WEBEVENTS.EVENTID
INNER JOIN WEBEVENTTYPEDESCRIPTIONS
ON WEBEVENTS.EVENTTYPE = WEBEVENTTYPEDESCRIPTIONS.EVENTTYPE
WHERE WEBPROGRAMPARTICIPANTS.ACCEPTED = 1
GROUP BY EVENTTYPEDESCRIPTION, YEAR(EVENTSTARTDATE)
ORDER BY EVENTTYPEDESCRIPTION, YEAR(EVENTSTARTDATE)
, который возвращает следующие результаты:
EventTypeDescripti Year TotalParticipants
Affiliate Workshop 2004 96
Affiliate Workshop 2005 132
Affiliate Workshop 2006 94
Affiliate Workshop 2007 125
Affiliate Workshop 2008 121
Affiliate Workshop 2010 170
Affiliate Workshop 2011 1
IPAM Long Program 2000 59
IPAM Long Program 2001 203
IPAM Long Program 2002 94
IPAM Long Program 2003 182
IPAM Long Program 2004 147
IPAM Long Program 2005 123
IPAM Long Program 2006 99
IPAM Long Program 2007 116
IPAM Long Program 2008 98
IPAM Long Program 2009 127
IPAM Long Program 2010 147
IPAM Long Program 2011 105
IPAM Long Program 2012 14
IPAM Reunion Conference 2002 108
IPAM Reunion Conference 2003 100
IPAM Reunion Conference 2004 98
IPAM Reunion Conference 2005 68
Мой вопрос заключается в том, как мне перестроить запрос, чтобы показать каждую EventTypeDescription, сжатую водна строка и показывает каждый год в виде столбца с соответствующим количеством
Пример:
Description Year Year etc...
Affiliate Workshop 96 132 ....