473,386 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Subtract records from two different tables

1 Bit
I have the following tables, with their fields.
TblSales
Saleid As auto Number
Saledate As Date
Item As Text
Brand As text
Quantity As Number
Unticost As currency
Totalcost As currency
Stockid As text

TblStock
Stockid As Text
StockName As Text
Brand As Text
Totalstock As Number
Stockremain As Number

How can I subtract sales Quantity from the Totalstock for every transaction

Am having too many logical errors Please someone help me

Thanks in advance
Jul 14 '22 #1
1 5627
NeoPa
32,556 Expert Mod 16PB
This seems to be a strange question.

Fomson:
How can I subtract sales Quantity from the Totalstock for every transaction?
It's almost like you think it makes any sense to do so in a report (or SELECT query). How could it? The [Totalstock] value would be the same for each associated transaction. Consider that you might have a number of items in stock starting at 100 then twenty different transactions of four each (adding up to eighty). Any such report would show ninety-six for each line.

No. You have to be clear about what each value means. Is it stock as at some time in the past? Is it ever updated? Which of the transaction items have already been applied to the stock levels so should not be counted again?

It actually is possible to get a reported value of stock items left using the original value and subtracting all relevant transactions, but as we've seen, this is not simple or straightforward. In practical terms most systems are designed so it is not required to process through all historical transactions (+ve & -ve) in order to determine the current status.
Fomson:
Am having too many logical errors Please someone help me
We can only really do that properly if/when you share with us some details of what you're trying to do and exactly what you're getting stuck on.
Jul 15 '22 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: manning_news | last post by:
Using SQL2000. How do I format my select statement to choose one out of 24 different tables? Each table is slightly different and I was hoping I could use one select statement and format it...
7
by: Paolo | last post by:
I know I should not be doing this, but I find it very useful. I have a database in Access which stores data for a small company. Sometimes we need to add similar information to different tables....
10
by: Marizel | last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I often find myself with a query which I'd like to reuse, but with a different datasource. These datasources generally have...
20
by: Dennis Gearon | last post by:
I am working on a design where a location for something can have: Fully qualified address with even building names, room numbers, and booth numbers. **-OR-** GPS location **-OR-** Both ...
0
by: apgoh | last post by:
Our system is on AIX5.3 ML5, DB2 v8.2 FP11, and we are running C applications. There are 2 scheduled cronjobs, which are actually triggering the same binary, but passing in different parameter....
2
by: lieufirst | last post by:
hi there, well i have a db that is consists of 6 tables. 1 for the detailed information of students, 1 for the exams they should take another table that combine student name and class and id from...
6
HaLo2FrEeEk
by: HaLo2FrEeEk | last post by:
I have two different tables which havea different number of columns. One of the tables gets a new row every day and is populated with a st of 4 IDs from another table, along with today's date and an...
14
by: PreethiGowri | last post by:
I want to subtract 2 column of two different tables and update in one of the table say, i have two tables 'main' and 'sub' both tables have a column named 'quantity' so i have to do it in this way:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.