Re: [GENERAL] SQL for Deleting all duplicate entries

2007-09-09 Thread brian
Håkan Jacobsson wrote: Thanx Merlin, have a nice one (vacation)! It turns out I have'nt described the problem accurately=( Data may actually differ in two of the columns (the varchar columns). I still want to remove rows which share the same data in those two columns and have the date column

Re: [GENERAL] SQL for Deleting all duplicate entries

2007-09-09 Thread Håkan Jacobsson
ns and Scotts solutions tomorrow. Anyone know if I need to modify Merlins and/or Scotts solutions to solve this new situation? /best regards, Håkan >Ursprungligt meddelande >Från: [EMAIL PROTECTED] >Datum: 09-09-2007 15:42 >Till: "Håkan Jacobsson"<[

Re: [GENERAL] SQL for Deleting all duplicate entries

2007-09-09 Thread Merlin Moncure
On 9/9/07, Håkan Jacobsson <[EMAIL PROTECTED]> wrote: > Merlin, > > Its just about three columns - not any column. Two columns are > varchars and the third is > a date. The date column value is NULL for the rows for which > I want to delete the duplicates. getting ready to go on vacation :). Th

Re: [GENERAL] SQL for Deleting all duplicate entries

2007-09-09 Thread Håkan Jacobsson
nde >Från: [EMAIL PROTECTED] >Datum: 06-09-2007 01:56 >Till: "Håkan Jacobsson"<[EMAIL PROTECTED]> >Kopia: >Ärende: Re: [GENERAL] SQL for Deleting all duplicate entries > >On 9/5/07, Håkan Jacobsson <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I w

Re: [GENERAL] SQL for Deleting all duplicate entries

2007-09-05 Thread Merlin Moncure
On 9/5/07, Håkan Jacobsson <[EMAIL PROTECTED]> wrote: > Hi, > > I want to create a DELETE statement which deletes duplicates > in a table. > > That is, I want to remove all rows - but one - having three > columns with the same data (more columns exist and there the > data varies). > For example: >

Re: [GENERAL] SQL for Deleting all duplicate entries

2007-09-05 Thread Scott Marlowe
On 9/5/07, Scott Marlowe <[EMAIL PROTECTED]> wrote: > begin; > delete from table where uid in (select * from table t1 join table t2 > on (t1.field1=t2.field1 AND t1.field2=t2.field2 AND > t1.field3=t2.field3 AND t1.uid>t2.uid) ); > (check for dups / lost data) > commit; There's a bug up there ^^^

Re: [GENERAL] SQL for Deleting all duplicate entries

2007-09-05 Thread Scott Marlowe
On 9/5/07, Håkan Jacobsson <[EMAIL PROTECTED]> wrote: > Hi, > > I want to create a DELETE statement which deletes duplicates > in a table. > > That is, I want to remove all rows - but one - having three > columns with the same data (more columns exist and there the > data varies). Assuming you've

[GENERAL] SQL for Deleting all duplicate entries

2007-09-05 Thread Håkan Jacobsson
Hi, I want to create a DELETE statement which deletes duplicates in a table. That is, I want to remove all rows - but one - having three columns with the same data (more columns exist and there the data varies). For example: column1 column2 column3 column4 column5 column2 = 'test', column3 =