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 8008881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:16:25+00:00 2026-06-04T18:16:25+00:00

I have a database in access 2010. A have a table that has some

  • 0

I have a database in access 2010.

A have a table that has some fields. Three of these are “input”, “output” and “date”.
A have also a total quantity query.

I want to sum all the “input” values that have the same “date” and I also want to sum all he “output” that have the same “date”.

I want my query to find the deduction result (“input” – “output” that have the same “date”).

My question is how to correlate different insertions that have the same “date” value.

Any help please?

EDITED:

input     output      date
  3         0         2/5/2012
  4         0         8/5/2012
  0         2         2/5/2012
  0         1         8/5/2012

I want my query to show

available stock     date
   (3-2=) 1       2/5/2012
   (4-1=) 3       8/5/2012

EDITED v2:

My sql code is

 SELECT SUM(warehouse.in_quant)-SUM(warehouse.out_quant) AS SUM, 
 drugs.active_substance, drugs.strength, drugs.strength_type, drugs.dosage_form, 
 warehouse.available_stock, drugs.minimum_quantity, IIf([warehouse]![available_stock]
 [drugs]![minimum_quantity],"YES!","No") AS DiplayText, warehouse.curr_date
 FROM drugs INNER JOIN warehouse ON drugs.ID = warehouse.drug_id;

I get this message:

You tried to execute a query that does not include the specified expression “active_substance” as part of an aggregate function.

When i remove the SUM(warehouse.in_quant)-SUM(warehouse.out_quant) AS SUM it works fine.

  • 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-04T18:16:27+00:00Added an answer on June 4, 2026 at 6:16 pm

    Go to the query design window, add the relevant tables, drag the fields that you want to match from one table to the next. Test. If it is not what you want, post the sql back here with sample data and an explanation of the problem.

    SELECT i.Input-o.Output As Stock, i.Date
    FROM (SELECT Input FROM Table
          WHERE Input > 0) i
    LEFT JOIN 
         (SELECT Output FROM Table
          WHERE Output > 0) o
    ON i.Date = o.Date
    

    You will probably need something more complicated, but this should be a start, hopefully.

    Re comments

    SELECT drugs.active_substance, 
           drugs.strength, 
           drugs.strength_type, 
           drugs.dosage_form, 
           warehouse.available_stock, 
           drugs.minimum_quantity, 
           warehouse.curr_date,
           SUM(warehouse.in_quant)-SUM(warehouse.out_quant) AS SUMQty
    FROM drugs 
    INNER JOIN warehouse ON drugs.ID = warehouse.drug_id
    GROUP BY drugs.active_substance, 
           drugs.strength, 
           drugs.strength_type, 
           drugs.dosage_form, 
           warehouse.available_stock, 
           drugs.minimum_quantity, 
           warehouse.curr_date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ms access database that has one table for each photo album
I have a table in a MS Access 2010 Database and it can easily
I have a split access 2007 database that has been running fine on a
I have an Access 2010 database that I want to split into two (front
I'm designing a database in Access 2010. I have this query that works as
I have inherited a old access database that includes a table with data organised
In my code, I have a database access context that provides elementary read/write operations,
I have a MS Access database (Access 2002, for the record). It has a
In an Access database I have 3 tables:Table,Table2 and Table3. Table1 is master for
I have read-only access to a database that was set up for a third-party,

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.