If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Using SUM in a search..

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-22-03, 17:33
rwstein rwstein is offline
Registered User
 
Join Date: Sep 2003
Location: Raleigh, NC
Posts: 1
Using SUM in a search..

Hiya gang...

Hope you can help.

We have a large Informix 4GL database, millions of records, hundreds of tables, etc etc.....

Specifically I need to know if I can perform the following search.

Let's say I want to see the total amount spent on all parts from a particular source.

The parts table would have fields for QTY, Part Number, Description, Cost, Mark-up %, Sell Price, and finally source. Now I can use * to denote anything in a field and = to denote and empty field while doing the search.

Is there a character such as these to denote the SUM OF ALL FOUND ENTRIES. For example If I want to search for all parts from the Source SONY it may bring up 20,000 different entries I can scroll through - but what if I just want to know the total of the cost of ALL parts from SONY.

Please tell me I don't have to develop a new table or function for this. I would really like to simply be able to enter SONY for source and put <whatever the character might be> in the cost field, hit ESC and bingo!

Please advise.

Thanks
Reply With Quote
  #2 (permalink)  
Old 09-23-03, 05:58
AdiHH AdiHH is offline
Registered User
 
Join Date: Jun 2003
Location: Hamburg, Germany
Posts: 38
Maybe I'm missing something, but can't you say...

select sum(qty*cost)
from parts
where source='SONY';

?

This will give you the total value (quantity * cost per part) of all SONY parts.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On