473,461 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How To using Query to calculate from many Table

Hi..

Im newbie and try to learn ms access, i use these syntax in query to calculate from different table.

Qry_NettoPerSPD

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT Tbl_Rincian.IdSPD, Sum([jmlpsn]*[hargasat]/(1-[PPN]*0.1)*((100-[diskon])/100)) AS Netto
  3. FROM Tbl_Rincian
  4. GROUP BY Tbl_Rincian.IdSPD;
  5.  
Query2

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT Tbl_Customer.IdCust, Tbl_SPD.TglSPD, Tbl_SPD.NoSPD, Tbl_PO.TglPO, Tbl_PO.NoPO, Qry_NettoPerSPD.Netto, Tbl_Customer.Contact, Tbl_Customer.Prus
  3. FROM Tbl_SuratJalan RIGHT JOIN (((Tbl_Customer INNER JOIN Tbl_PO ON Tbl_Customer.IdCust = Tbl_PO.idCust) INNER JOIN ((Tbl_SPD LEFT JOIN Tbl_SJdanSPD ON Tbl_SPD.NoSPD = Tbl_SJdanSPD.NoSPD) INNER JOIN Qry_NettoPerSPD ON Tbl_SPD.NoSPD = Qry_NettoPerSPD.IdSPD) ON Tbl_PO.NoPO = Tbl_SPD.idPO) INNER JOIN Tbl_Rincian ON Tbl_SPD.NoSPD = Tbl_Rincian.IdSPD) ON Tbl_SuratJalan.NoSj = Tbl_SJdanSPD.NoSJ
  4. GROUP BY Tbl_Customer.IdCust, Tbl_SPD.TglSPD, Tbl_SPD.NoSPD, Tbl_PO.TglPO, Tbl_PO.NoPO, Qry_NettoPerSPD.Netto, Tbl_Customer.Contact, Tbl_Customer.Prus;
  5.  
First time i making the Qry_NettoPerSPD and than Query2, is that correct ?
Anybody have different way to making more simple Query than above?


thank you for all advise...
bahenol
Aug 31 '07 #1
5 1798
NeoPa
32,556 Expert Mod 16PB
If you can explain what it is you're hoping to achieve we could look at it for you. If you expect someone to reverse engineer your existing code so they can even find out what the question means then perhaps you need to reconsider. I await your response.
Sep 2 '07 #2
I' m sorry about my question before, the question is... how to creating the result value from calculating field who related with the other table in just one query, i'm try to using 2 queries to have the calculation result between the relation table

First Query:

Qry_NettoPerSPD
Expand|Select|Wrap|Line Numbers
  1. SELECT Tbl_Rincian.IdSPD, Sum([jmlpsn]*[hargasat]/(1-[PPN]*0.1)*((100-[diskon])/100)) AS Netto
  2. FROM Tbl_Rincian
  3. GROUP BY Tbl_Rincian.IdSPD;
Second Query :

Query2

Expand|Select|Wrap|Line Numbers
  1. SELECT Tbl_Customer.IdCust, Tbl_SPD.TglSPD, Tbl_SPD.NoSPD, Tbl_PO.TglPO, Tbl_PO.NoPO, Qry_NettoPerSPD.Netto, Tbl_Customer.Contact, Tbl_Customer.Prus
  2. FROM Tbl_SuratJalan RIGHT JOIN (((Tbl_Customer INNER JOIN Tbl_PO ON Tbl_Customer.IdCust = Tbl_PO.idCust) INNER JOIN ((Tbl_SPD LEFT JOIN Tbl_SJdanSPD ON Tbl_SPD.NoSPD = Tbl_SJdanSPD.NoSPD) INNER JOIN Qry_NettoPerSPD ON Tbl_SPD.NoSPD = Qry_NettoPerSPD.IdSPD) ON Tbl_PO.NoPO = Tbl_SPD.idPO) INNER JOIN Tbl_Rincian ON Tbl_SPD.NoSPD = Tbl_Rincian.IdSPD) ON Tbl_SuratJalan.NoSj = Tbl_SJdanSPD.NoSJ
  3. GROUP BY Tbl_Customer.IdCust, Tbl_SPD.TglSPD, Tbl_SPD.NoSPD, Tbl_PO.TglPO, Tbl_PO.NoPO, Qry_NettoPerSPD.Netto, Tbl_Customer.Contact, Tbl_Customer.Prus;
How to calculate relation table with just one query (without Qry_NettoPerSPD) ?

Thank you for all advice, suggest and helpfull comment..
Sep 4 '07 #3
Jim Doherty
897 Expert 512MB
I' m sorry about my question before, the question is... how to creating the result value from calculating field who related with the other table in just one query, i'm try to using 2 queries to have the calculation result between the relation table

First Query:

Qry_NettoPerSPD

Code: ( sql )

1.
SELECT Tbl_Rincian.IdSPD, Sum([jmlpsn]*[hargasat]/(1-[PPN]*0.1)*((100-[diskon])/100)) AS Netto
2.
FROM Tbl_Rincian
3.
GROUP BY Tbl_Rincian.IdSPD;


Second Query :

Query2

Code: ( sql )

1.
SELECT Tbl_Customer.IdCust, Tbl_SPD.TglSPD, Tbl_SPD.NoSPD, Tbl_PO.TglPO, Tbl_PO.NoPO, Qry_NettoPerSPD.Netto, Tbl_Customer.Contact, Tbl_Customer.Prus
2.
FROM Tbl_SuratJalan RIGHT JOIN (((Tbl_Customer INNER JOIN Tbl_PO ON Tbl_Customer.IdCust = Tbl_PO.idCust) INNER JOIN ((Tbl_SPD LEFT JOIN Tbl_SJdanSPD ON Tbl_SPD.NoSPD = Tbl_SJdanSPD.NoSPD) INNER JOIN Qry_NettoPerSPD ON Tbl_SPD.NoSPD = Qry_NettoPerSPD.IdSPD) ON Tbl_PO.NoPO = Tbl_SPD.idPO) INNER JOIN Tbl_Rincian ON Tbl_SPD.NoSPD = Tbl_Rincian.IdSPD) ON Tbl_SuratJalan.NoSj = Tbl_SJdanSPD.NoSJ
3.
GROUP BY Tbl_Customer.IdCust, Tbl_SPD.TglSPD, Tbl_SPD.NoSPD, Tbl_PO.TglPO, Tbl_PO.NoPO, Qry_NettoPerSPD.Netto, Tbl_Customer.Contact, Tbl_Customer.Prus;

How to calculate relation table with just one query (without Qry_NettoPerSPD) ?

Thank you for all advice, suggest and helpfull comment..

A pointer for you....have a look at the concept of 'derived tables' and 'sub correlated' queries. There are a multitude of references on the web and online ready made simple examples that you can copy down, learn from and apply to your access environment.

Jim
Sep 4 '07 #4
Ok.. Jim... thank you
Sep 4 '07 #5
NeoPa
32,556 Expert Mod 16PB
Nice one Jim.
I'm afraid I was no better able to understand the question after the second version than after the first. The OP obviously made the effort so no criticism there, but I was still lost.
Anyway, I will try to ensure your status is updated by the end of the weekend at least.
Sep 4 '07 #6

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

Similar topics

4
by: Bacci | last post by:
I have two tables. The first is "Locations" which has 52,000 zip codes w/cooresponding latitudes and longitudes. The second "Suppliers" has 2,000 company names and addresses. The user enters a...
2
by: Phil Powell | last post by:
Relevancy scores are normally defined by a MySQL query on a table that has a fulltext index. The rules for relevancy scoring will exclude certain words due to their being too short (minimum...
14
by: Bob | last post by:
Hi there, Need a little help with a certain query that's causing a lot of acid in my stomach... Have a table that stores sales measures for a given client. The sales measures are stored per...
2
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
1
by: Guido | last post by:
How to cope with query output which provides all possible values based on a one to many relationship between two tables. I'm only interested in one answer per primary key in the 'one' table. I've...
8
by: Bri | last post by:
Greetings, I am using Eval() in a query with only limited success. If the text within the function contains a reference to a Field I get #ERROR#. I'll try and explain what I'm trying to do and...
3
by: Wired Hosting News | last post by:
Lets say I have 10 products in 10 different stores and every week I get a report from each store telling me how many items they have left for each of the 10 products. So each week I enter in 100...
5
by: Wired Hosting News | last post by:
I tried to be breif and give a scenario so as not to be overlooked because it was soooo long. Let me give you real world. I am a manufacturer of goods and produce 11 items that are distributed...
0
by: Sebastien.LICHTHERTE | last post by:
Hello, I need to calculate the median and percentile of values in a group by query satisfying several criteria the user is asked to fill in when opening the query. A have a table called RX with...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.