Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I need a SQL string to group by rset based a variable..
    Attached sheet with the structure of my real access table named DATI.
    Admit:
    var1=4500 is refred the filed (PROVA2)
    var2=07/04/2009 is refred the filed (PROVA9)
    var3=BUSINESS is refred the filed (PROVA12)
    var4=50163743 is refred the filed (PROVA119)

    How to Group By the rset based the for variable and return the summ by PROV13
    In this case with the for param the sum is 287.293,81

    In Acess query editor have teste the sql:

    SELECT sum(PROVA13) AS TOTALI, PROVA2, PROVA9, PROVA12, PROVA19
    FROM DATI
    WHERE PROVA2='4500' AND PROVA9=07/07/2009 AND PROVA12='BUSINESS' AND PROVA19='50163743'
    GROUP BY PROVA2, PROVA9, PROVA12, PROVA19;

    but the result return all rset blank! i see only the name of fileds

    in effect i want after query sql this ressult:
    4500 07/04/2009 BUSINESS 287.293,81 50163743

  2. #2
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='sal21' post='772255' date='25-Apr-2009 12:49']I need a SQL string to group by rset based a variable..
    Attached sheet with the structure of my real access table named DATI.
    Admit:
    var1=4500 is refred the filed (PROVA2)
    var2=07/04/2009 is refred the filed (PROVA9)
    var3=BUSINESS is refred the filed (PROVA12)
    var4=50163743 is refred the filed (PROVA119)

    How to Group By the rset based the for variable and return the summ by PROV13
    In this case with the for param the sum is 287.293,81

    In Acess query editor have teste the sql:

    SELECT sum(PROVA13) AS TOTALI, PROVA2, PROVA9, PROVA12, PROVA19
    FROM DATI
    WHERE PROVA2='4500' AND PROVA9=07/04/2009 AND PROVA12='BUSINESS' AND PROVA19='50163743'
    GROUP BY PROVA2, PROVA9, PROVA12, PROVA19;

    but the result return all rset blank! i see only the name of fileds

    in effect i want after query sql this ressult:
    4500 07/04/2009 BUSINESS 287.293,81 50163743[/quote]

    Resolved but i have used this sql:

    SELECT PROVA2, PROVA9, PROVA12, PROVA19, sum(PROVA13) AS TOTALI
    FROM DATI
    WHERE PROVA2 = '4500'
    AND PROVA9 = #2009-04-07#
    AND PROVA12 = 'BUSINESS'
    AND PROVA19 = '50163743'
    GROUP BY PROVA2, PROVA9, PROVA12, PROVA19

    see the filter of PROVA9

    why the query do not accept the format #07/04/2009#?????????????

    Attached structure of my table and show data

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •