> -----Original Message-----
> From: Paul DuBois [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 12, 2003 11:33 AM
> To: Luc Foisy; MYSQL-List (E-mail)
> Subject: RE: Is there any way to search a whole database for a value?
> 
> 
> At 9:21 -0500 3/12/03, Luc Foisy wrote:
> >Perhaps one day UNION will be added to UPDATE
> 
> You'd still have to name every column to be updated explicitly.
> There is no "update whatever column happens to contain this value"
> syntax.

of course you would have to name everything explicitly, but the original
task was to update several tables/columns, not necessarily all tables and 
all columns, so thats not much of a problem.

A thought about the UNION, might as well do two UPDATE's :)

You have available to you as of 4.0.4 the multi-table UPDATE

UPDATE [LOW_PRIORITY] [IGNORE] tbl_name [, tbl_name ...]
    SET col_name1=expr1 [, col_name2=expr2 ...]
    [WHERE where_definition]

Curious if the columns are named the same in all tables if you could a single SET, 
such as...

UPDATE table1, table2 SET column = 5 WHERE column = 10

If you feel the need to go further with such strange tactics, you could use the
multi-table UPDATE to explicitly name columns up to the allow query length

Then again I am no Paul Dubois, just putting out some thoughts that may tickle some 
peoples fancy :)

> >>  I need to look in several different tables/columns in a
> >>  database for a
> >>  particular value.  If I find it, I need to update it.  Is
> >>  there any way to
> >>  search/update every table/column in one query in a
> >  > particular database?
> 
> 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to