Select CompanyName, Max(ChosenPackage) As ChosenPackage From tblName
Group By Company Name

But what if they downgrade? Perhaps another table is in order -
something to keep a history of package changes.

~Brad 

-----Original Message-----
From: Craig [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 23, 2002 11:38 AM
To: ActiveServerPages
Subject: SQL Question.


Here's the simplified version.

Database with 2 fields, CompanyName and ChosenPackage where CompanyName
is varchar and ChosenPackage is integer (1,2 0r 3). If a company
upgrades from package 1 to package 2 or 3 I still want to retain the
original record in the database so I might end up with a recordset like
this:

CompanyName  ChosenPackage
Freds Automotives  1
Big Book Shop      1
Sams Toilet Repair 1
Sams Toilet Repair  2
Kipper Shoppe      3
MacDonalds         1
Wendys             2
MacDonalds         3

I'll be using a WHILE NOT rs.EOF to print out all the records but in the
case where there is more than one entry for a CompanyName I only want to
include that CompanyName record where the ChosenPackage is of the
highest value. In other words in this case I would want to exclude 2
records, MacDonalds 1 AND Sams Toilet Repair 1

Thanks.

---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED] To unsubscribe send a blank email to
%%email.unsub%%


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to