Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:04:43+00:00 2026-06-08T17:04:43+00:00

I have a requirement to pull a total # of product quantity from an

  • 0

I have a requirement to pull a total # of product quantity from an Access DB, but include the vendor name, id number, description, etc… along with the sum of quantity.

I have a query like this:

SELECT [Vendor Name], SUM([Quantity]) AS Total
FROM [SalesDB]
WHERE [Vendor No] IN (1,2,3,4,5,6,7,8) AND [Item Description] = 'bolts'
Group By [Vendor Name]

Works great… except I need to pull more columns in the query, something like this:

SELECT [Vendor Name], [Vendor No], [Item No], [Item Description], [Item Cost], [Quantity],  SUM([Quantity]) AS Total
FROM [SalesDB]
WHERE [Vendor No] IN (1,2,3,4,5,6,7,8) AND [Item Description] = 'bolts'
Group By [Vendor Name]

Doesn’t work, throws an aggregate error

So instead do something like so:

SELECT [Vendor Name], [Vendor No], [Item No], [Item Description], [Item Cost], [Quantity],  SUM([Quantity]) AS Total
FROM [SalesDB]
WHERE [Vendor No] IN (1,2,3,4,5,6,7,8) AND [Item Description] = 'bolts'
Group By [Vendor Name], [Vendor No], [Item No], [Item Description], [Item Cost], [Quantity]

Which runs but changes the results too much. What’s the appropriate way to handle this query?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:04:48+00:00Added an answer on June 8, 2026 at 5:04 pm

    try this:

    You have to make your first query as a derived table and join with the actual table to get all the fields

        SELECT A.[Vendor Name], [Vendor No], [Item No], [Item Description], 
    [Item Cost], [Quantity],B.Total
     from [SalesDB] A 
     inner join
        (SELECT [Vendor Name], SUM([Quantity]) AS Total
        FROM [SalesDB]
        WHERE [Vendor No] IN (1,2,3,4,5,6,7,8) 
        AND [Item Description] = 'bolts'
        Group By [Vendor Name])B
      on A.[Vendor Name]=B.[Vendor Name]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i have requirement to process large number of files via multithreading in java.
In our project we have requirement that, after receiving sms message from third party
I have a requirement where certain code cannot be seen by all developers, but
I have a customer service web app requirement, which requires that I work pull
I have a requirement to load text labels from our CMS. The content is
I'm trying to write code to pull a list of product items from a
I have a requirement where I HAVE TO use bootstrap autocomplete dropdown, BUT user
I have requirement where some times I would like to load children as well
I have requirement to disable copy/paste/cut operations on a textbox. For this purpose I
I have requirement, wherein I have to calculate totals for cash and credit cards

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.