Add total column to ms access pivot sql

leeroypitre
leeroypitre used Ask the Experts™
on
How to modify the following query to add a total column of TaskSelected?

TRANSFORM COUNT(T.TaskSelected)
SELECT R.TAID, T.TaskSelected
FROM RBWS R
LEFT JOIN TaskSelected T  ON R.TaskSelectedID=T.ID
GROUP BY R.TAID
PIVOT T.TaskSelected
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Owner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010
Commented:
Try:

TRANSFORM COUNT(T.TaskSelected)
SELECT R.TAID, T.TaskSelected, SUM(IIF(ISNull(T.TaskSelected), 0, 1)) as Total
FROM RBWS R
LEFT JOIN TaskSelected T  ON R.TaskSelectedID=T.ID
GROUP BY R.TAID
PIVOT T.TaskSelected 

Open in new window

Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Commented:
glad to help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial