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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to process a recordset with 2 customer id's that have diff values

Status
Not open for further replies.

colezpapa

Programmer
Feb 26, 2007
86
US
I have to process a file that can contain the cust id more than one time. I will need the record with the highest status value. What's the best approach here.
What's the best way to do this...Code or query?
In the example, I would want the GHI with the status = 1.

Cust ID Status

ABC 2
DEF X
GHI 1
GHI 2
NJO 1
MNK X
KNL 2
 
colezpapa said:
I will need the record with the highest status value...... In the example, I would want the GHI with the status = 1
So actually you want the record with the lowest status value (last I checked, 1 was less than 2).

Code:
SELECT [Cust ID], Min(Status) FROM YourTableName GROUP BY [Cust ID]


 
yes, thats correct. I get it backward here and there!!!!
Thanks for your response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top