Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

max, min, total of a record

Status
Not open for further replies.

JustATheory

IS-IT--Management
Feb 27, 2003
115
US
Is there a way to run a total, max or min on a record?


Account Total Val1 Val2 Val3
123 10 0 10 0
456 3 2 0 1
789 4 2 2 0


The Total column is correct but I want to identify records that have multiple entries for that total. I would identify records 2 and 3. I was thinking running a max or min and comparing to the total.

Thanks,
JustATheory
 
Sorry not seeing multiples in the data provided. Totals all look unique...

Ni neart go cur le cheile.
 
Records 2 and 3 have more than 1 column that sum to the total, so I would Identify those records(other than 0). Record 1 has 1 entry that equals the total.

I was able to get the results I wanted writing it in the Having expression.

Thanks,
JustATheory
 
Personally, I'd put the data vals in normalized tables, simplifying this entire question.

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
The initial problem is misusing tables with an array like list of fields Val1,Val2,Val3. In a normalised structure you can use SQL min,max,avg,sum.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top