Possible Duplicate:
SQL - How can I remove duplicate rows?
I have a table that's structured like this:
create table MnA
(id int PRIMARY KEY IDENTITY not null,
symbol nvarchar(4) not null,
direction nvarchar(4) not null,
start_dt nvarchar(5) not null,
end_dt nvarchar(5) not null,
start_doy int not null,
end_doy int not null,
avg_price int not null,
min_price int not null,
max_price int not null,
avg_percent int not null,
min_percent int not null,
max_percent int not null,
history text not null,
percent_hit int not null,
aw_length int not null,
diff int not null,
date_change int not null)
I would like to delete rows that have similarities.
If the row has the same symbol, direction, start_doy
and diff
then I want to keep the one with the highest avg_percent
.
How would I accomplish this?