Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007
    Posts
    22

    Lightbulb Unanswered: Summing values with same date

    Hi all;
    I am trying to make an applicaiton in VS.Net. Im not good at SQL. This application works with MS Access db. The problem is that I have to make a query which is very hard to me. I made a lot of research but I cant find what I need. The problem is:
    I have a table with 2 integer values and a date. (eg: int1,int2,date). My query shall multiply int1 and int2 and it is simple.
    Table:
    1 5 10.01.2007
    2 3 17.01.2007
    5 7 12.02.2007
    8 1 23.02.2007

    First my wuery shall do this

    5 10.01.2007
    6 17.01.2007
    35 12.02.2007
    8 23.02.2007

    Second step is to add all values with same month and year like this:

    11 01.2007
    43 02.2007

    Is it possible to make all these steps with a sql code? If yes how?

    Thanks very much for any help...

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    select sum(int1*int2), format([date],"m.yyyy")
    from daTable
    group by format([date],"m.yyyy")
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2007
    Posts
    22
    so simple thanks very mcuh im trying this...

Posting Permissions

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