[thelist] sql de-doupe

Brian Cummiskey brian at hondaswap.com
Sat Feb 2 03:53:07 CST 2008

Ken Schaefer wrote:
> The basic problem is that in your set of sample records, you have no duplicates.
> I assume that you mean that the "model" values are duplicated? For each duplicate model record, which category record do you wish to keep?
> If you can just list (a) your starting record set and (b) your final record set, it usually becomes trivial to write some SQL to do what you want.
> Cheers
> Ken
> -----Original Message-----
> modelA  cat1
> modelA  cat2
> modelB  cat1
> modelB  cat2

Hi Ken,

Perhaps i wasn't clear :)

The category is not necessary/important, so i'm simply taking the first 
one via the top 1 command.   There are 20-odd other fields to the right 
as well which don't matter much.

Out of those 4, I need:

modelA  whatever_cat_comes_first
modelB  whatever_cat_comes_first

to be returned

More information about the thelist mailing list