List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:July 21 1999 5:34pm
Subject:Re: Select Distinct
View as plain text  
Jeff Schwartz wrote:
> 
> I apologize if this is obvious but I've checked the manual and mail list
> archives.
> 
> I need several fields of data where one of the fields is distinct. So,
> below, for each unique ename, I want their ename, a_id, and last_mail.
> However, "distinct" is being applied to all fields and I get duplicate
> ename's.
> 
> "select distinct ename, a_id, last_mail from affiliates where
> ename='jeff@stripped'"
> 
> How can I apply the distinct criteria to a single field but still get
> the data on other fields?
> 
> Thanks,
> Jeff

Not sure what it is exactly that you are trying to accomplish, but it
seems to me that you do not need distinct, or even selecting ename at
all - you already know it because of youre WHERE clause. Just do:

select a_id, last_mail from affiliates where ename =
'jeff@stripped';

If you want to see only one row, append limit 1 to the query. 

-- 
Sasha Pachev
http://www.sashanet.com/ (home)
http://www.direct1.com/ (work)
Thread
Select DistinctJeff Schwartz21 Jul
  • Re: Select DistinctSasha Pachev21 Jul
  • Select Distinctsinisa22 Jul