Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Kha Vu <VuK at franklins dot com dot au>
Subject: RE: A Way Side Question
Date: Aug 25 1999 12:43AM

if there are more fields apart from the 3 (what, color, sex) then case 1
doesnot work, the result is eliminated for one record if there is  another
record with exactly the same attributes.
in case 2 you can have a query like this
select distinct what, color, sex
from .....

> ----------
> From: 	Charles Zhao[]
> Sent: 	Wednesday, 25 August 1999 10:12
> To: 	SybPerl Discussion List
> Subject: 	A Way Side Question
> Well, this is not a DBLib question.  It's a pure SQL question, but since
> we  
> all deal with SQL, you might have good ideas:
> I have table with records like this:
> ==============================
> cat	black	male	...
> bird	red	male	...
> cat	white	female	...
> cat	grey	female	...
> cat	black	male	...
> bird	white	female	...
> I need to select records from this table with distinct combinations of the
> above 3 columns.  Thus duplicate rows like "cat black male ..." will be  
> eliminated from my selection.  How can do it?
> 1.  "select distinct * from .." is not a choice;
> 2.  How does this work: "select distinct WHAT, distinct COLOR, distinct
> SEX  
> from ..."?
> Thanks
> Charles Zhao