Re: How do i get partial DISTINCT's
Posted in 1996
> chips@eskimo.com (:crp:) writes:
> I have one table with 5 columns, John - George - Paul - Ringo - Beatle.
> The data within needs to transferred over to another table, TabB.
> TabB has a unique index based on John-George combo.
> I am using SE 4.10 : how can i accomplish this?
>
> Using "Select distinct (John,George), Paul, Ringo,Beatle" doesn't work
> as distinct applies to all the columns, which i don't want. Just the
> rows with distinct John,George.
>
> Any solutions appreciated.
Try:
insert into TabB
select John, George, max(Paul), max(Ringo), max(Beatle)
from TabA
group by John, George
You may want to use min instead of max.
Also be aware of strange results as the values from the three last fields
may not come from the same row in TabA.
Nils.Myklebust@ccmail.telemax.no
NM-data, Aasesvei 71, 1300 Sandvika, Norway
My opinions are those of my company