Database Error when returning Count for Subtotal

S

Steve

I'm trying to write the query for returning subtotal from the Results. I
went to Thingumajig and followed the instructions and the query will return
subtotals, only if I remove the SELECT Count portion of the code.

SELECT State, ILN, ACO, (Select Sum(ACO) FROM Results AS Results_1 WHERE
Results_1.ILN = Results.ILN AND Results_1.State = Results.State) As TotalACO
FROM Results; of course I get a total for every row, so when I put in the
count part of the query I get the DB error.

This is what I've writen for the Count:
SELECT State, ILN, ACO, (Select Sum(ACO) FROM Results AS Results_1 WHERE
Results_1.ILN = Results.ILN AND Results_1.State = Results.State) As TotalACO,
(SELECT Count(ACO) FROM Results AS Results_1 WHERE Results_1.ILN =
Results.ILN AND Results_1.State = Results.State) AS Count FROM Results;

Being new to coding in FP I'm lost. Any assistance would be most
appreciative.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top