Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2004
    Location
    Bucharest, Romania
    Posts
    16

    Unanswered: Autosum in a query

    Hi,

    I'm new on this forum and I'll appreciate your help.

    I have a table that looks like that:

    id transaction date
    a -20 01.01.06
    a 500 01.01.06
    a 500 01.01.06
    b -400 01.01.06
    b 450 01.01.06
    .....

    I want to sum all transaction on each date for each id like:
    a 980 01.01.06
    b 50 01.01.06


    I know how to do that in a report, but it's possible to do it directly in a query? I need the data in a new table.
    Any clue?

    Thanks.
    Daniel

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372

    Hello Daniel!

    Look at "DemoAutosumQA2000.mdb",
    Open Query1.
    Attached Files Attached Files

  3. #3
    Join Date
    Mar 2004
    Posts
    58
    I suppose that the structure of your table (myTable) is as follow

    column1|coumn2|column3
    ---------------------------
    a |-20 | 01.01.06
    a | 500 | 01.01.06
    a | 500 | 01.01.06
    b |-400 | 01.01.06
    b | 450 |01.01.06

    the query should be

    Select column1, sum(column2) as thesum, column3
    From myTable group by column1

    From the above query yuo can do an insert

    Hope that will help

  4. #4
    Join Date
    Apr 2004
    Location
    Bucharest, Romania
    Posts
    16
    Quote Originally Posted by MStef-ZG
    Look at "DemoAutosumQA2000.mdb",
    Open Query1.
    You are right, this is simple.
    I realize that my question was not very clear.

    I need to autosum. Thant means that for id a to have 980 for 01.01.06 and for 05.01.06 to have 980 + 300 + (-400) = 880.

    Thanks for your help.
    Dny

  5. #5
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Ok Daniel, only push out "fDate" from "Query1".

  6. #6
    Join Date
    Apr 2004
    Location
    Bucharest, Romania
    Posts
    16
    Quote Originally Posted by MStef-ZG
    Ok Daniel, only push out "fDate" from "Query1".
    In fact I need to do a stock projection, based on initial stock, forecast (values entered with "-") and suppy, therefore it's important to have the date and the stock projection for each date.

    Dny

  7. #7
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Ok Daniel, It's up to you.

Posting Permissions

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