Of course, but for some reason that solution didn't just pop into my head until after I sent the email. I should have given it a bit more thought.
-----Original Message----- From: Dylan Barber [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 1:48 PM To: ActiveServerPages Subject: RE: SQL Question. Steve Wouldn't it be better to have the DB do the filter? ____________________________________________________ Dylan Barber (CIW Professional, A+ Technician) Webmaster & Content Manager Codegalaxy.com e-mail [EMAIL PROTECTED] -----Original Message----- From: Steve Abaffy [mailto:[EMAIL PROTECTED]] Sent: Monday, September 23, 2002 1:44 PM To: ActiveServerPages Subject: RE: SQL Question. SQL = "Select * from CompanyTable order by CompanyName asc,ChosenPackage desc" This will return CompanyName ChosenPackage Big Book Shop 1 Freds Automotives 1 Kipper Shoppe 3 MacDonalds 3 MacDonalds 1 Sams Toilet Repair 2 Sams Toilet Repair 1 Wendys 2 THEN IN CODE CurrentCompany = "" While NOT RS.EOF IF CurrentCompany <> RS("CompanyName") 'Which it will not the first time Response.write RS("CompanyName") & " " & RS("ChosenPackage") CurrentCompany = RS("CompanyName") END IF RS.MoveNext WEND -----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.unsub%% --- 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]
