DISTINCT - Mailing list pgsql-sql

From Rudi Starcevic
Subject DISTINCT
Date
Msg-id 3D814DEB.6090807@oasis.net.au
Whole thread Raw
Responses Re: DISTINCT  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-sql
Hello,

I'd like to select from one table ( contains duplicates ) into a new table.
However the new table is exactly the same as the original ( duplicates 
included )
I think I have a problem with my DISTINCT clause - sql below.

It seems the DISTINCT is applied to the whole row not just the 'phone' 
field.
Is the a way I can select the whole row into a new table based on a DISTINCT
phone number ?

Is the a way I can select the whole row into a new table based on a DISTINCT
phone number and state ?


Else I'll need to select into a table then select again etc,etc ....to 
remove duplicates.

SELECT   DISTINCT phone,   company_name,   address,   state,   idc_desc_1,   street_number,   street_name,
street_xtra,  suburb,   postcode,   area_code,   ac_phone,   fax_area_code,   fax_phone,   fax_ac_phone,   latitude,
longitude
INTO export_temp
FROM export;

Thanks
Rudi



pgsql-sql by date:

Previous
From: Joe Conway
Date:
Subject: Re: [GENERAL] Latitude / Longitude
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: DISTINCT