How to pick any one of duplicate records in a table
Posted on 2011-09-28
I have a Part master tab1 with unique partno which is the key, and another tab2 being loosely organized with reference info and most likely with deuplicate partno records. The two tables look like:
Tab1 (Note that the partno is the key)
Tab2 (Note the partno most likely are duplicated)
My mission is to set relation using partno and pick the Refno from tab2. If duplicated records in Tab2, then just pick any one -- only one record from the duplicated records from Tab2.
The result table will look like:
111 2000 (or 9000, doesn't matter)
In old VFP command, I can use
SET RELATION TO partno INTO tab2
REPLACE tab1.field1 WITH tab2.refno
How to accomplish in SQL?