Thanks. I would never of thought of that!

Dan

From: [email protected] 
Sent: Wednesday, March 21, 2012 9:49 AM
To: RBASE-L Mailing List 
Subject: [RBASE-L] - Re: SQL Help
Just doing this off the top of my head, but this should work:

select zipcode, dlrnum, zipdistance from tablename t1, tablename t2 where 
t1.zipcode = t2.zipcode and t2.zipdistance = (select min(zipdistance) from 
tablename where zipcode = t1.zipcode)

You use the same table (view) name everywhere in the statement.

Karen


In a message dated 3/21/2012 11:33:57 AM Central Daylight Time, 
[email protected] writes: 

  I have a view that has each zipcode, dlrnum, zipdistance
    
  I need to find and store the zipcode, dlrnum based on the minimum distance.
    
  I can find the minimum distance by zipcode but how do I get the dlrnum as 
well?
    
  I know there must be a way to use a sql to get this but am coming up blank.
    




Reply via email to