473,414 Members | 1,665 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,414 software developers and data experts.

How compute and link table 1 and table 2

Hi there,
Got prob on computing this fields... i want to sum up a purchased field then less consumed field in query2, to have total available... below are my sample data:

formula on the "available" : would be if total consumed will be higher than sep1 purchased, it will tag as "0" else output total purchased - total consumed

i have query 1 which contains:
date: purchased: & available
sep1 50
sep2 100
sep3 50
sep4 200

in query 2
date: consumed:
sep5 100
Sep 26 '10 #1
2 1421
nico5038
3,080 Expert 2GB
Can you post the queries ?

In general using your query1 and query2 slightly changed in a UNION query would be the "blunt" way to solve this.

Expand|Select|Wrap|Line Numbers
  1. select date, purchased, 0 from query1
  2. UNION
  3. select date, 0, consumed from query1
  4.  
By using this query in a GROUPBY query you can get the purchased and consumed in one row and thus your calculation can be performed.

I wouldn't use a field [available], as that's the result of the sum of purchases minus the [consumed], thus a deductible field and according the normalization rules these aren't stored...

Nic;o)
Sep 26 '10 #2
hi nico
tnx for the reply... heres my query1
SELECT Efa_pur.ExpiryDate, Sum(Efa_pur.NoMeds) AS SumOfNoMeds
FROM Efa_pur
GROUP BY Efa_pur.ExpiryDate

and query2
SELECT DISTINCTROW Sum(Efa.Pills) AS [Sum Of Pills]
FROM Efa
GROUP BY Efa.ExpDate;

sir, can i send you attachment here? i'll give you the details of my formula created in excel file that i wanted to replicate in my queries in ms-access..

maybe you have another option on how to handle my query

many thanks in advance
Sep 27 '10 #3

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

Similar topics

9
by: michael | last post by:
Anyone knows if it is possible to make the complete area of a table cell a link onmousover or by hover? In other words, I'd like to link, not only the text within the cell, but the entire cell as...
1
by: boonkit | last post by:
I try to get better performance by implementing this: http://dev.mysql.com/doc/mysql/en/alter-table.html "ORDER BY allows you to create the new table with the rows in a specific order. Note...
7
by: Bruce Lawrence | last post by:
I have an Access97 database and I would like to link a SQL table to it without having to create a manual ODBC connection on every system that needs to use this database. This is what I have so...
1
by: Bruce Lawrence | last post by:
I know this works for Access 97. Not sure about other versions. This will create a DSN to a SQL server in your ODBC connections and then link a table of your choise from that SQL DB to the...
2
by: imtmub | last post by:
Dear All, I have two tables that contain same fields but different month records. Now i want link two table to search perticular Id data from both table. (Example: In the both table i have the Name...
10
richardhodge
by: richardhodge | last post by:
I am a VB6 database programmer and have run into a small problem. The company I work for primarily uses Microsoft Access 2000 for the database that is the back end for our software. Well the...
2
by: arishani | last post by:
i have a table in an access database called documents , i am in need for the data of this table to be found on a table inside SQL, this table have the same characteristics as the table documents. Can...
1
idsanjeev
by: idsanjeev | last post by:
<%@ Language =vbscript%> <% Option Explicit %> <html> <head><TITLE>VOICE OF BARAUNIANS</TITLE></head> <body> <!--#include file="front.inc"--> <div style="Position:Absolute; width:700; TOP:0;...
3
eclypz
by: eclypz | last post by:
Hello, I have 2 DB's, DB1.mdb are in a share and DB2See.mdb that ppl use to see data. what i want is in the DB2See.mdb link a table that exists in the DB1. I have this done yet with the...
0
by: shalini166 | last post by:
i have 2 table maingroup(table1) fields:(mgshortname,mgcode,mgname) values(EN,100,Engine) component(table2)
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.