[thelist] Simple table question...

Jonathan Dillon jdillon at boehm-ritter.com
Mon May 9 19:03:30 CDT 2005

>On 5/9/05, Jonathan Dillon <jdillon at boehm-ritter.com> wrote:
>> SELECT DISTINCT(email), firstname, lastname, phone FROM tablename;
>> This is rather retarded, but why would this pull up duplicate emails?  
>> I just don't understand.  I thought DISTINCT would explicitly be 
>> distinct to the column name.
>What is it to do with the following data?
>joe at blow.com Joe Blow 555-555-5555
>joe at blow.com Joe Blow 555-555-5556
>What row is it supposed to return?
>The reality is that every unique *combination* of fields listed after the
DISTINCT keyword will be returned.



Yea, that's exactly what the data is doing.  So, would changing the order

SELECT firstname, lastname, phone, DISTINCT(email) FROM tablename;

How do you get around this seemingly simple problem?  I've got about 15% too
many records!  I need records distinctly keyed off their emails... ;-)

Thanks for the reply,


More information about the thelist mailing list