Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Select DISTINCT statement?

Author  Topic 

mapperkids
Yak Posting Veteran

50 Posts

Posted - 2007-02-01 : 10:32:14
Hi,

I use the "SELECT DISTINCT * From TABLE_A" to get the unique records and it is fine, but how can I copy/save the result recordset to a new table, so I can get a rid of those duplicated records.

Thanks!

Kristen
Test

22859 Posts

Posted - 2007-02-01 : 10:34:09
INSERT INTO Table_NEW
SELECT DISTINCT *
From TABLE_A

or, if the table does not yet exist:

SELECT DISTINCT *
INTO Table_NEW
From TABLE_A

Kristen
Go to Top of Page
   

- Advertisement -