Sum, count and divide

Giganews Newsgroups
Subject: Sum, count and divide
Posted by:  Luciano \(DOC\) (lucianod…@luciano.doc)
Date: Thu, 28 Oct 2010

I have a table having this structure:
idrecord
nation
value
What I have to get by a query is grouping records by nation, summing and
counting the values, dividing negative by positive.
Therefore:
USA, sumOfPositiveValues, CountOfPositiveValues, sumOfNegativeValues,
CountOfNegativeValues
ITALY, sumOfPositiveValues, CountOfPositiveValues, sumOfNegativeValues,
CountOfNegativeValues
FRANCE, sumOfPositiveValues, CountOfPositiveValues, sumOfNegativeValues,
CountOfNegativeValues
I hope I was clear enough :-)
Thanks.

Luciano

Replies