Re: remove duplicates

  • From: Alisher Yuldashev <yuldashev@xxxxxxxxxxx>
  • To: barb.baker@xxxxxxxxx
  • Date: Wed, 28 Jul 2010 13:34:53 -0400

Hmm... just realized I sent it too early.

The correct statement is
delete from woe_fact_barb where (woe_sid,wo_sid) in (select min(woe_sid),wo_sid from woe_fact_barb group by wo_sid having count(1)>1);

Alisher Yuldashev wrote:
Barbara,

This will delete all duplicate rows with the minimal woe_sid
delete from woe_fact_barb where (woe_sid,wo_sid) in (select min(woe_sid),wo_sid from woe_fact_barb group by wo_sid);

This one is to delete the minimal woe_sid with wo_sid equal 177694790
delete from woe_fact_barb where wo_sid=177694790 and woe_sid = (select min(woe_sid) from woe_fact_barb where wo_sid=177694790);

Thanks,
Alisher Yuldashev
www.pythian.com

Other related posts: