Help with Totals Query

  • Thread starter Thread starter Arvin Villodres
  • Start date Start date
A

Arvin Villodres

Hi!!!
When I try to execute this query:

SELECT Sum(tblPayrollTransactions.NETPAY) AS SumOfNETPAY,
tblPayrollTransactions.PAYDATE
FROM tblPayrollTransactions
GROUP BY tblPayrollTransactions.PAYDATE
HAVING (([EMPID] <>"3-1120100"));

I have this error:

Error: You tried to execute a query that does not include
the specified expression
'Not [EMPID] ="3-1120100"' as part of an aggregate
function.

My objective is to get the total Netpay excluding the
person with this Employee ID.
I should make it appear in a query as totals query.

What do you think should I do?

Thanks very much for your help.
 
Hi!!!
When I try to execute this query:

SELECT Sum(tblPayrollTransactions.NETPAY) AS SumOfNETPAY,
tblPayrollTransactions.PAYDATE
FROM tblPayrollTransactions
GROUP BY tblPayrollTransactions.PAYDATE
HAVING (([EMPID] <>"3-1120100"));

The HAVING operator is applied *after* all the totals are done; the
WHERE operator is applied first. If you want to exclude 3-1120100 from
consideration and sum the rest, change the HAVING to WHERE.
 
Back
Top