Agregat compute

  • 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


    Kindest Regards,

    degrem_m
    Degremont

  • 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,

  • Hello,

    I would like to do this query into access design but I don't know to do.

    I want that my query return all elements + sum from this total element


    Kindest Regards,

    degrem_m
    Degremont

  • 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