
Getting Unique records...DISTINCT I guess...
Roswell,
This will work for the sample data you posted ... whether it will work for
your actual data, I don't know.
create table Roswell
(
ID int NOT NULL,
Data varchar (15)
)
go
insert into Roswell values (1234, 'Camping Site A')
insert into Roswell values (3239, 'Camping Site B')
insert into Roswell values (3043, 'Camping Site C')
insert into Roswell values (1234, 'Camping Si')
select ID, MAX (Data) as Data
from Roswell
group by ID
-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.
Quote:
> Hello, all. I have the following table, and only want the unique or
> distinct values for the ID column. I suppose I'll need the DISTINCT
clause.
> 1234,Camping Site A
> 3239,Camping Site B
> 3043,Camping Site C
> 1234,Camping Si 'intentionally typed
> I only want returned:
> 1234,Camping Site A
> 3239,Camping Site B
> 3043,Camping Site C