Re: How do i get partial DISTINCT's
Posted in 1996
You are confused, I think. There are two possible scenarios.
Scenario 1:
TabA has no records with duplicate values in the John-George combo.
* You can use this statement because there are no duplicates of
John-George:
INSERT INTO TabB SELECT DISTINCT John, George, Paul, Ringo, Beatle
Scenario 2:
TabA has records with duplicate values in the John-George combo.
* Since TabB has a unique index on John-George, you need to establish
the criterion which will be used to decide which row will be
selected from TabA for insertion to TabB. Presumably, it does
matter which data you get? If the Paul column contains "Yes" or
"No", and it probably matters which row from TabA gets placed in
TabB; if it doesn't, why are the Paul, Ringo and Beatle columns
even in TabB since they don't contain deterministic information.
Review your design -- you have a logic problem.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
>From: chips@eskimo.com (:crp:)
>Date: Wed, 10 Jan 1996 19:04:52 GMT
>X-Informix-List-Id: <news.20169>
>
>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.