Thread: Using Distinct
View Single Post
 
Old December 17th, 2007, 11:10 AM
Gert Gert is offline
Authorized User
 
Join Date: Jun 2003
Location: , , Norway.
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi.

Are you sure Jeff's code doesn't do what you want?
Since he is joining the [Tablename] with the #myhead-table on the distinctive Tel-coloumn, then only the last of the updates for a duplicate will stick.

I tried his code, and it gave only one person pr telephone-number.

(Only thing is that there is a syntax error at the beginning, it should say:
SELECT TEL, FIRSTNAME, LASTNAME, ADDRESS1, TOWN, COUNTY INTO #MyHead
FROM [TABLENAME]
  WHERE 1 = 0

Or am I missing somtehing in your picture?