Results 1 to 3 of 3
  1. #1
    Mattbro is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    100

    Query for sum of values by date

    Hello all,


    I have two tables;
    A table showing the item details-Table FinalWork; Receive Date, ID (Primary Key), NoBricks, NoCubes, DateBooked, DateOut


    A table showing how may whole time equivalent (WTE) staff are in post on that day. Table Hours; Date (primary Key), WTE


    I have a relationship between Hours.Date and Finalwork.ReceiveDate.


    I am trying to develop a query and ultimately a report that will return the sum of NoBricks, the sum of NoCubes and number for WTE for each day (ReceiveDate).

    So far I am struggling-the SQL reads;
    Code:
    SELECT Sum(FinalWork.[Total NoBricks]) AS [SumOfTotal NoBricks], Sum(FinalWork.[Total NoCubes]) AS [SumOfTotal NoCubes], Hours.WTE, FinalWork.[Receive Date]
    FROM FinalWork INNER JOIN Hours ON FinalWork.[Receive Date] = Hours.Date
    GROUP BY Hours.WTE, FinalWork.[Receive Date], FinalWork.[DateOut], FinalWork.[DateBooked], FinalWork.[ID];
    I am sure my problem is in the GROUP BY section, but I have been looking everywhere- at the group function in reports, and DCount, amongst other things, but I am not getting anywhere. If anyone can help, I would be grateful.
    Regards,
    Mattbro

  2. #2
    offie is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    176
    Why are you grouping by fields you haven't selected?

  3. #3
    Mattbro is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    100
    ....because I keep getting 'does not include specified expression' ' as part of the aggregate function' warnings. I think you are right though-having removed the articles that cause the warning from the query, I am now getting the data I want.
    Thanks,
    Mattbro

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

Similar Threads

  1. Replies: 5
    Last Post: 10-12-2012, 11:00 AM
  2. Replies: 3
    Last Post: 07-19-2012, 06:51 AM
  3. Replies: 0
    Last Post: 07-16-2012, 01:48 PM
  4. Replies: 15
    Last Post: 04-06-2012, 10:57 AM
  5. Replies: 10
    Last Post: 11-06-2011, 01:30 PM

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