Results 1 to 5 of 5
  1. #1
    cap.zadi is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    KSA
    Posts
    481

    Sum in a Query by date.

    Hey there,



    i having a query with the following fields:

    MachineID, TranDate, PrdDate, GoodQTY, BadQty, CarNo


    M1 12/10/2011 11/09/2011 20 10 1A
    M1 12/10/2011 11/09/2011 05 01 1A
    M1 12/10/2011 11/07/2011 09 07 1A

    So what i am looking here is if on same Trndate there is same Prddate and same careNo so must be add up and show one results.


    plz advise.

    thanks

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    must be add up and show one results
    Must add the records? Which fields?

    Add the fields across?

    Which addition are you looking for? Perhaps if you showed expected results it would be helpful.

  3. #3
    cap.zadi is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Sir to addup Good Qty and BadQty if the TranDate, prodndate and KCarNo is same so can show us against this CarNo how much is GoodQty and BadQty.


    M1 12/10/2011 11/09/2011 20 10 1A
    M1 12/10/2011 11/09/2011 05 01 1A
    M1 12/10/2011 11/07/2011 09 07 1A


    Results:

    M1 12/10/2011 11/09/2011 25 11 1A
    M1 12/10/2011 11/07/2011 09 07 1A

    *this value is not added beacuse the Prddate is different.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Have you set up a query? Can you show us the SQL? What result/error?

    Your field names are inconsistent and makes your post confusing.
    Trndate there is same Prddate and same careNo so must be add up and show one results.
    Good Qty and BadQty if the TranDate, prodndate and KCarNo is same so can show us against this CarNo
    MachineID, TranDate, PrdDate, GoodQTY, BadQty, CarNo

  5. #5
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Try this:
    Code:
    SELECT Table2.MachineID, Table2.TranDate, Table2.PrdDate, Sum(Table2.GoodQty) AS SumOfGoodQty, Sum(Table2.BadQty) AS SumOfBadQty, Table2.CarNo
    FROM Table2
    GROUP BY Table2.MachineID, Table2.TranDate, Table2.PrdDate, Table2.CarNo;

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query by date
    By fpmsi in forum Queries
    Replies: 4
    Last Post: 09-22-2011, 01:00 PM
  2. query to update a date based on another date
    By tkendell in forum Access
    Replies: 3
    Last Post: 06-29-2011, 09:32 PM
  3. Date query help!!!
    By dduvvuru in forum Queries
    Replies: 2
    Last Post: 08-27-2010, 12:59 PM
  4. Date query
    By Philangr8 in forum Queries
    Replies: 7
    Last Post: 10-06-2009, 04:37 PM
  5. Replies: 2
    Last Post: 07-31-2009, 06:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums