7 messages in com.mysql.lists.mysqlRe: merging rows within same table
FromSent OnAttachments
Oleg Timofeyev15 Feb 2000 20:34 
sin...@mysql.com16 Feb 2000 06:38 
Oleg Timofeyev17 Feb 2000 15:02 
Jon Keller17 Feb 2000 15:07 
Steve Ruby17 Feb 2000 15:21 
Thimble Smith17 Feb 2000 18:28 
sin...@mysql.com18 Feb 2000 06:29 
Subject:Re: merging rows within same table
From:sin...@mysql.com (sin@mysql.com)
Date:02/16/2000 06:38:20 AM
List:com.mysql.lists.mysql

Oleg Timofeyev writes:

Hi,

Here is what I am trying to do. I have a table1 which has ID and KEYWORDS for example:

1 - money 1 - power 1 - love 2 - family 2- free 2 - love 2 - money

Now I would like to make all those records ID 1, so I am doing:

update table1 SET UNIQUEID=1 WHERE UNIQUEID=2

But that generates duplicate KEYWORDS with the same ID, how can I avoid that. I dont see an option here to do it in one query, but I will be more than happy if someone will show me wrong. Thanks a lot, its my second day on this list and I already learned and accomplished so much with your help.

Sincerely, Oleg Timofeyev

Hi !

Try this:

update table1, table1 as table2 SET UNIQUEID=1 WHERE table1.UNIQUEID=2 AND table1.keyword != table2.keyword

Regards,

Sinisa