List:General Discussion« Previous MessageNext Message »
From:kalle volkov Date:April 15 1999 9:31am
Subject:Re: Wading straight in...
View as plain text  
hi!

select email, id, name from table group by email;

... should do it... if u have duplicate email's then it takes first
record with the email and shows id and name from this record...

regs,
cal6

---

Paul Lawton wrote:
> 
> Hi there, My name's Paul, I've just joined the list and I'm gonna be rude and
> jump straight in with a question!
> 
> I'm trying to extract the distinct emails from a table with about 30 fields in
> it. The following:
> select distinct(email) from table;
> 
> is fine. But when I want the associated fields as well e.g. id,name etc
> select distinct(email),id,name from table;
> 
> I get too many records as it seems to be doing a distinct on the id as well.
> 
> I have solved the problem using 2 nested statements in PHP but I was wondering
> if there
> was a more elegant way of doing it in one select statement.
> 
> Paul Lawton     Raver / Software Engineer     Modem Media . Poppe Tyson
> Tel: 44 171 878 5723                          [ http://sscape.bog.net ]
> ICQ: 10999748                                    [ http://www.ush.net ]
>        .oO[ I'll never grow old because of my personality! ]Oo.
> 
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread1887@stripped
> 
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.
Thread
Wading straight in...Paul Lawton15 Apr
  • Re: Wading straight in...kalle volkov15 Apr
    • RE: (Wading straight in...) (Query Help)Jay Miller15 Apr