Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Raleigh, NC

    Unanswered: 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.


  2. #2
    Join Date
    Jun 2003
    Hamburg, Germany
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts