Re: NEED SQL HELP PLEASE, SELECT DISTINCT QUESTION
Posted in 1998
Try this -->
select * from zztest a
where rowid = (select min(rowid) from zztest
where col1= a.col1)
zigzag <zigzag@infi.net> on 10/02/98 02:27:18 PM
Please respond to zigzag@infi.net
To: informix-list@iiug.org
cc: (bcc: Rajesh Kapur/CBSI/Spartan)
Subject: Re: NEED SQL HELP PLEASE, SELECT DISTINCT QUESTION
Paul, either would be acceptable.
Paul Roberts wrote:
> In article <3614F1C3.8386F4F1@infi.net>, zigzag <zigzag@infi.net> wrote:
> >I have a table which contains several columns. I would like to
retrieve
> >the rows from this table, but remove duplicates based on one column
> >only.
> >
> >For example:
> >
> >Row# Col A Col B Col C
> >1 cat AA BB
> >2 cat BB CC
> >3 dog CC DD
> >4 hat DD EE
> >5 dog EE FF
> >
> >I want to select rows so that they are unique on Col A only, so the set
> >returned would only
> >contain rows, 1,3 and 4.
> >
> >If I was writing this Select in my own language it would be something
> >like this:
> >"Select ColA, ColB, ColC from table where ColA is unique."
>
> But why would this return rows 1,3 & 4 and not, say,
> rows 2,4 & 5? That set is 'equally unique' in ColA.
> Am I missing something?
>
> - Paul
>