[thelist] sql de-doupe
Ken Schaefer
Ken at adOpenStatic.com
Sat Feb 2 04:45:56 CST 2008
SELECT
Model,
MIN(Category)
FROM
YourTable
GROUP BY
Model
HAVING
COUNT(Model) > =1
Cheers
Ken
-----Original Message-----
From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Brian Cummiskey
Sent: Saturday, 2 February 2008 8:53 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] sql de-doupe
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
--
* * Please support the community that supports you. * *
http://evolt.org/help_support_evolt/
For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !
More information about the thelist
mailing list