SQL Query - need MS Access wizard! COUNT & GROUP
Posted: Thu Mar 19, 2009 6:16 am
Hello - thanks for opening this question. I am raising this on behalf of a friend who is working in MS Access.
He is trying to get a result of three columns: Fee Earning (containing their grouped name), File summary (containing the amount of times a "no" has been entered), and Letterhead (containing the amount of time a "no" has been entered there).
So far, the result is a Grouped list of FeeEarners, and a Count of number of rows - period! So whether one column has a YES and two NOs, it produces a result of "3".
If the 'FeeEarning' has three NOs in fileSummary and two YESs in Letterhead, the result needs to be:
FeeEarningName - 3, 2.
Hope someone can help.
Simon
He is trying to get a result of three columns: Fee Earning (containing their grouped name), File summary (containing the amount of times a "no" has been entered), and Letterhead (containing the amount of time a "no" has been entered there).
Code: Select all
SELECT matters.FeeEarner,
Count(matters.FileSummary) AS FileSummary,
Count(matters.Letterhead) AS Letterhead
FROM matters
WHERE matters.FileSummary ='no' OR
WHERE matters.FileSummary ='no'
GROUP BY matters.feeEarner;
If the 'FeeEarning' has three NOs in fileSummary and two YESs in Letterhead, the result needs to be:
FeeEarningName - 3, 2.
Hope someone can help.
Simon