I have the query below:
select distinct column0, id
group by id,column0
The ID field is an auto increment field and is necessary to keep the codes in cloumn0 in a specific order.
If I run this query it does not select unique records from Column0, but returns all records. (There are about 20,000 duplicates in column0 out of total 1 million records)
I need to return only unique records in column0 but keep the sort on the ID field.
Sample data shown below:
I can use the query:
select distinct column0 from codes_all
but then SQL messes up the order of column0 - I need it in the order in which it was imported in to the table.
Using MS SQL 2005 Express.
Help needed ASAP