0

So I have a table with fields ID (AI, primary key), ticker, priceDate, price.

I have a bunch or records that share the same priceDate and ticker. There should only be one record per ticker for any given priceDate.

How would I go about removing these duplicate records, given that priceDate and ticker are not unique fields?

4

1 回答 1

1
delete from your_table
where id not in 
(
  select * from 
  (
    select min(id)
    from your_table
    group by pricedate, ticker
  ) x
)
于 2013-05-10T12:49:26.093 回答