select pKey, field1, min(field2) from myTable where field2 <> '-' and pKey<20000 group by field1 order by pKey,field2