SELECT CompanyName, MAX(ChosenPackage) FROM tabComapany GROUP BY CompanyName
-----Original Message----- From: Craig [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 1:38 PM 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]
