March 20, 2006 at 1:49 pm
Hi,
I would like to know if in sql access is it possible to use COMPUTE in query to return total.
Exemple : SELECT Nom, Tarif FROM Modele COMPUTE SUM (Tarif) BY Nom ORDER BY Nom ;
Because I have a mistake : syntaxe Error near FROM clause
But in this URL, article says it's possible : http://support.microsoft.com/kb/194005/en-us
degrem_m
Degremont
March 20, 2006 at 3:13 pm
Are you using ADO or DAO? The article is referring to ADO. Have you tried
SELECT Nom, Sum(Tarif) AS SumOfTarif
FROM Modale
GROUP BY Nom
ORDER BY Nom;
Thanks,
March 22, 2006 at 10:10 am
Do you want all elements to display this same sum from this total element?
If so, make the summation query as a separate query, perhaps "qryTotal". Then, in your separate element query, add "qryTotal" using the "Show Table" button and link qryTotal's nom field to your Modale table's nom field.
Like so:
Save this as "qryTotal"
SELECT Nom, Sum(Tarif) AS SumOfTarif
FROM Modale
GROUP BY Nom
ORDER BY Nom;
Then, your new query would be
SELECT Modale.Nom, Modale.Tarif, qryTotal.SumOfTarif
FROM Modale INNER JOIN qryTotal ON Modale.Nom = qryTotal.Nom;
Does this do what you want?
Thanks,
Metra
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply