Calculating total prices only for specific records

dbmanalser84

Registered User.
Local time
Today, 08:57
Joined
Feb 26, 2008
Messages
52
Look at this query:

qryUvoz.jpg


I wan't to calculate the price totals but for each instance of Uvoz ID separately. I've sucessfully used Dsum function but I managed only to calculate all price totals for all instances of Uvoz ID. Is it possible to do it for each number of Uvoz ID separately? How do I do it?
 
Try a query:

SELECT [Uvoz ID], Sum([cena modela]) AS TotalSales
FROM TableName
GROUP BY [Uvoz ID]

You should avoid the use of spaces in your names. They are not worth the trouble in the long run.
 
but

Try a query:

SELECT [Uvoz ID], Sum([cena modela]) AS TotalSales
FROM TableName
GROUP BY [Uvoz ID]

You should avoid the use of spaces in your names. They are not worth the trouble in the long run.

I don't use spaces in my field names these are captions for better display. When I tried this syntax acces throw syntax error missing operator at me. Can you explain this in little more detail? I've never seen this construction of SELECT statement
 
That's simple totals query, very common for grouping and summing data. Perhaps if you post your SQL we'll see what's wrong with it.
 
Here...

That's simple totals query, very common for grouping and summing data. Perhaps if you post your SQL we'll see what's wrong with it.

Here's my SQL for this query:

Code:
SELECT tblUvoz.intUvozID, tblUvoz.dteDatumUvoza, tblSpediter.txtNazivSpeditera, [txtNazivProizvodjaca] & " - " & [txtNazivModela] AS Auto, tblAutomobil.intCenaModela, tblUvozAutomobil.intKolicinaUvoz
FROM (tblSpediter INNER JOIN tblUvoz ON tblSpediter.intSpediterID = tblUvoz.intSpediterID) INNER JOIN (tblProizvodjac INNER JOIN (tblAutomobil INNER JOIN tblUvozAutomobil ON tblAutomobil.intAutomobilID = tblUvozAutomobil.intAutomobilID) ON tblProizvodjac.intProizvodjacID = tblAutomobil.intProizvodjacID) ON tblUvoz.intUvozID = tblUvozAutomobil.intUvozID
ORDER BY tblUvoz.intUvozID;

Tell me what to change in order to get what I wan't and if you can explain it a little bit. Thnx
 
Code:
[txtNazivProizvodjaca] & " - " & [txtNazivModela] AS Auto
What are these? If they are fields in the query, you need the table name. If they are text boxes on a form, you need the form name.
 
They are...

Code:
[txtNazivProizvodjaca] & " - " & [txtNazivModela] AS Auto
What are these? If they are fields in the query, you need the table name. If they are text boxes on a form, you need the form name.

These fields are table fields that represent the manufacturer name and car model name joined as one field, but I don't see what these fields have to do with anything, all I'm trying to do is to calculate the total prices of cars sold during the one sale (Uvoz ID), but in my example on querie you see many Sales Numbers (1,2,3) and cars connected to those sales.

So, is there a solution?
 
Have you used the SUM operator that pbaldy advised?
 
Thanx

Try a query:

SELECT [Uvoz ID], Sum([cena modela]) AS TotalSales
FROM TableName
GROUP BY [Uvoz ID]

You should avoid the use of spaces in your names. They are not worth the trouble in the long run.

That's it. :) Took me a while to figure it out. Sorry for aditional trouble. Thnx
 

Users who are viewing this thread

Back
Top Bottom