Katya85S
Programmer
- Jul 19, 2004
- 190
The select query consists of number of INNER JOINs and brings several records per CustomerAccount different by 2 fields: Day field and Balance field.
What I need is: 1 record per customer. The record should have the lowest balance of the selected Customer and the earliest day.
I thought min and max functions could do that,
I’ve tried etc.
SELECT Account, CustomerName, min(AccBalance) FROM ….
GROUP BY Account, CustomerName, AccBalance
but I was getting the same number of records per customer as when I didn’t use the min function.
What am I doing wrong and how to have displayed just the lowest Balance and the earliest day?
Thank you all in advance...
What I need is: 1 record per customer. The record should have the lowest balance of the selected Customer and the earliest day.
I thought min and max functions could do that,
I’ve tried etc.
SELECT Account, CustomerName, min(AccBalance) FROM ….
GROUP BY Account, CustomerName, AccBalance
but I was getting the same number of records per customer as when I didn’t use the min function.
What am I doing wrong and how to have displayed just the lowest Balance and the earliest day?
Thank you all in advance...