|
Subject:
|
Distinct
|
|
Posted By:
|
Eddywardo
|
Post Date:
|
8/31/2006 3:08:04 AM
|
Hi, I've recently moved a site to MSSQL server from Access and I've hit a few problems as it implements SQL differently. I've had a lot of duplicate data on the site which I have partly remedied by using SELECT DISTINCT - though I don't know how to use this in conjunction with SELECT * to cure other parts of my site that return duplicate data. Does anyone know how to do this? Thanks!
|
|
Reply By:
|
shahchi1
|
Reply Date:
|
9/2/2006 7:41:40 AM
|
If you have a table called MyTable with duplicate rows
Then
SELECT DISTINCT Col1,Col2.. FROM myTable INTO NewTable
TRUNCATE MyTable
INSERT INTO MyTable SELECT * FROM NewTable
DROP TABLE NewTable
|