when a row of a subset is lost/deleted/moved away from it, the whole subset will need to be reordered.This can be done similarily : SET @pos=0; UPDATE busstops SET pos = ( SELECT @pos := @pos 1 ) WHERE route = 1 ORDER BY pos ASCChris H (chansel0049) I experienced a weird issue converting from 4 to 5.What I'm doing here is copying the information I need from the row where job_id=1 to the row where job_id=6, on the same table.Adam Boyle's commment above was just what I was trying to do, update one table based on a relationship between that table and another.
Notes: That index addition is necessary because on larger tables my SQL would rather die than figure to (internally) index a single column join.
UPDATE tbl_name SET fld2 = CASE fld1WHEN val1 THEN data1WHEN val2 THEN data2ELSE fld2 ENDThe note is: do not forget ELSE.
If you do not use it, all rows that are outside the range of your updated values will be set to blank!
So, I do it in one "magick" query ;)Here an example:"3" is a some value, from form or somethingupdate item set rate = case when round((rate 3)/2) You sometimes run into the problem that you want to replace a substring occuring in a column with a different string, without touching the rest of the string.
The solution is surprisingly simple, thanks to My SQL: UPDATE xoops_bb_posts_text SET post_text=( REPLACE (post_text, 'morphix.sourceforge.net', ' the string function REPLACE, all items in the post_text column with 'morphix.sourceforge.net' get this substring replaced by '
For multiple-table updates, there is no guarantee that assignments are carried out in any particular order. COLUMN2 IS NULLAn outerjoin is performed based on the equijoin condition.