Hi Folks.
I have a table with 10 columns and each column could contain 1 of 3 possible enteries.
I've got a query that will sum 1 column and I'm trying to get my head around how to sum the other 9 columns, in 1 query.
Here's the code, thanks in advance for any help.
Cheers,
Jon
I have a table with 10 columns and each column could contain 1 of 3 possible enteries.
I've got a query that will sum 1 column and I'm trying to get my head around how to sum the other 9 columns, in 1 query.
Here's the code, thanks in advance for any help.
Code:
SELECT tblVotes.Res1, Sum(IIf(Res1="0",1,0)) AS [FOR], Sum(IIf(Res1="1",1,0)) AS AGAINST, Sum(IIf(Res1="2",1,0)) AS ABSTAIN
FROM tblVotes
GROUP BY tblVotes.Res1
ORDER BY tblVotes.Res1;
Cheers,
Jon