Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    UK
    Posts
    11

    Unhappy Unanswered: Need SQL to add up numbers in a field for a query / report

    I have a database that stores orders and order items (Code and Quantity fields) amongst other things. I have a query set up to display the details of a set of orders (a delivery) and a report to display them.
    I need to be able to display a total quantity of items. I've done this before but for the life of me i can't remember the SQL to do it!

    Something like "Sum ([Quantity])" as an additional field in the query?
    i've tried this and it gives me an error message about not having the customer id?
    I just want a total of the values that the quantity fields contain?

    Any help would be greatfully appreciated!!!

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    Select item, SUM(qty)
    from orders
    group by item;
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Feb 2004
    Location
    UK
    Posts
    11

    Errrr???

    Thanx for the reply!
    Do i type this into a new field in the query?Im not that experienced with access??

  4. #4
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    SQL Query -> Design View -> Right Click -> SQL View.
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Posting Permissions

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