Mufasa,
In SQL Server 2005, it's not hard:
with T as (
select
*,
row_number() over (
partition by your_unique_key
order by their_unique_key
) as occurence
from theTable
)
select <columns you want>
from T
where occurence = 1
This selects the first occurrence in their-key order of
each customer (as defined by your-key).
Steve Kass
Drew University
http://www.stevekass.com
Mufasa wrote:
>I've got a list of customers, customer names, ... from another db (I didn't
>design it).
>
>I want to get a list of all of the customers plus the first customer name.
>So if customer 1 appears twice (customer name = 'Fred' and 'John') I want
>the first one it finds.
>
>Is there an easy way to do this without spinning through all of the records.
>I'm using the results of the query as a select statement as input to an
>insert statement.
>
>TIA - Jeff.
>
>
>
> >> Stay informed about: Selecting from a table where my unique Key is not their un..