Nuno Pereira <[EMAIL PROTECTED]> wrote on 08/05/2005 02:41:45 PM: > Following the "SELECT DISTINCT" topic, I have another question. > > I tryed to UPDATE all the tables, replacing one column in every tables > with the contents of one specific row. I tried this, but the syntax is > incorrect: > > UPDATE int_contxtd_details SET params=(SELECT params FROM > int_contxtd_details WHERE id=35) WHERE id!=35; > > Can anyone help? > -- > Nuno Pereira >
I think you want to use a variable... SELECT @NewValue := params FROM int_contxtd_details WHERE id=35; UPDATE int_contxtd_details SET params = @NewValue; In this case, even if you overwrite the value where id=35, you will be giving back the same value it started with so no harm. Running the UPDATE statement without a WHERE clause will be faster because it won't have to check ID values for every row to make sure it's OK to update that row. Make sense? Shawn Green Database Administrator Unimin Corporation - Spruce Pine PS. The other way I could think to write this query was with a self-join but I don't think it would be as fast as using the variable.