Results 1 to 8 of 8
  1. #1
    ariansman is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    57

    a query to bring us sort and sum at t he same time

    We have the following table:



    ID​
    Staff​
    ItemName​
    Price​
    Qnt​
    Cost​
    1​
    John​
    Book​
    5​
    3​
    15​
    2​
    Mori​
    pencil​
    6​
    7​
    42​
    3​
    Tom​
    Book​
    7​
    4​
    28​
    4​
    Tom​
    paper​
    10​
    6​
    60​
    5​
    Mori​
    paper​
    10​
    3​
    30​
    6​
    John​
    pencil​
    6​
    2​
    12​
    7​
    John​
    Book​
    5​
    1​
    5​
    8​
    Mori​
    paper​
    10​
    8​
    80​
    9​
    Mori​
    pencil​
    6​
    4​
    24​
    10​
    Mori​
    ink​
    12​
    3​
    36​



    Can I get the following result in a query?

    Staff Cost​
    John 32​
    Mori 212​
    Tom 88​

    I hope i find a solution for this in this forum.
    thank you

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,240
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,840
    use an aggregate query (in query design, click the sigma symbol - totals), group and sort on the staff column, sum the cost column, you should end up with something like

    SELECT Staff, sum(Cost) as ttlCost
    FROM myTable
    GROUP BY Staff
    ORDER BY Staff

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,240
    Quote Originally Posted by Ajax View Post
    use an aggregate query (in query design, click the sigma symbol - totals), group and sort on the staff column, sum the cost column, you should end up with something like

    SELECT Staff, sum(Cost) as ttlCost
    FROM myTable
    GROUP BY Staff
    ORDER BY Staff
    Already been advised that in the other forum.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,840
    so I see - complete waste of my time and effort and after some 200 posts on this and the other forum, needs to ask the question?

    OP would be well advised to read this http://www.excelguru.ca/content.php?184

    Will go on my ignore list as this has really annoyed me

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,240
    Quote Originally Posted by Ajax View Post
    so I see - complete waste of my time and effort and after some 200 posts on this and the other forum, needs to ask the question?

    OP would be well advised to read this http://www.excelguru.ca/content.php?184

    Will go on my ignore list as this has really annoyed me
    You have actually called him out in it in the past, as he has done it several times.
    https://www.accessforums.net/showthr...ht=crossposted
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    ariansman is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    57
    Quote Originally Posted by Welshgasman View Post
    Already been advised that in the other forum.
    Man, I understand your rules, sorry if i violated it. I am simply looking for an answer. I desperately need it.
    I will only post on this forum next time.

  8. #8
    ariansman is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    57
    it worked. thank you man

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

Similar Threads

  1. Sort by date AND time
    By SiebeD in forum Queries
    Replies: 1
    Last Post: 03-11-2021, 09:01 AM
  2. Replies: 1
    Last Post: 06-28-2019, 08:07 AM
  3. Sort by time slot?
    By EchoEleven in forum Reports
    Replies: 13
    Last Post: 04-23-2016, 08:53 AM
  4. Bring in date and time into one field
    By Ruegen in forum Queries
    Replies: 7
    Last Post: 08-11-2014, 09:59 PM
  5. Replies: 5
    Last Post: 03-19-2014, 02:31 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