dbTalk Databases Forums  

SQL query

comp.database.ms-access comp.database.ms-access


Discuss SQL query in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pascal Herms
 
Posts: n/a

Default SQL query - 09-13-2003 , 04:46 PM






Hi All,

I'm using the following query to select records in a database:

SELECT (consumpties.prijs*aantallen.aantal) AS subtotaal, * FROM Leden INNER
JOIN (Consumpties INNER JOIN Aantallen ON Consumpties.Id =
Aantallen.consumptie) ON Leden.id = Aantallen.Leden WHERE Aantallen.Leden="
& naam_id & " ORDER BY consumpties.soort, consumpties.naam

The field subtotaal is created by multiplying two fields with each other.
Now I want to add all values in this subtotaal field, but I don't know how.
I know I have to use the sum() thingy, but I don't know how I should build
it into the query I made.
Please, can anybody help me?

with regards,
Pascal Herms




Reply With Quote
  #2  
Old   
Pascal Herms
 
Posts: n/a

Default Re: SQL query - 09-15-2003 , 04:43 PM






Hi,

I found out how to do it.
I just made another query. The same as mentioned below, but without the
order clause.
It works perfect. It might not be the most correct way, but hey, it works.

greetings,
Pascal

"Pascal Herms" <pherms (AT) planet (DOT) nl> schreef in bericht
news:bk03bp$k77$1 (AT) reader10 (DOT) wxs.nl...
Quote:
Hi All,

I'm using the following query to select records in a database:

SELECT (consumpties.prijs*aantallen.aantal) AS subtotaal, * FROM Leden
INNER
JOIN (Consumpties INNER JOIN Aantallen ON Consumpties.Id =
Aantallen.consumptie) ON Leden.id = Aantallen.Leden WHERE
Aantallen.Leden="
& naam_id & " ORDER BY consumpties.soort, consumpties.naam

The field subtotaal is created by multiplying two fields with each other.
Now I want to add all values in this subtotaal field, but I don't know
how.
I know I have to use the sum() thingy, but I don't know how I should build
it into the query I made.
Please, can anybody help me?

with regards,
Pascal Herms






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.