Re: Help With Another UPDATE Query Please!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If you were using MySQL 4.0.4 or newer then yes you can do a 
multi-table update. However, since you are not, you will need to come 
up with a different way. Off hand I would think that depending on how 
large your tables are and the amount of available memory you have, you 
could handle this using PHP doing something like:

Do a select of your Work_Type table for Work_Type and Work_Type_ID.
Do another select of your Projects for Work_Type and some other unique 
column.
Then using PHP loop through the Projects result set doing:
	Locate the proper Work_Type_ID for the current Work_Type
	Update the Projects table's Work_Type_ID matching the unique column.

Not a great solution. Not fast. It may work. Hopefully, someone else 
will have a better way of doing this. 

If it is feasible you may want to consider upgrading to 4.0.15. The 
MySQL support people are strongly suggesting the everyone moves to 
4.0.x. They consider the 3.23.x as end of its life-cycle and only 
releasing bug fixes for it.

On Sat, 4 Oct 2003 14:20:02 +0100, Shaun spoke thusly about Re: 
 Help With Another UPDATE Query Please!:
> I am using mySQL 3.23
> 
> Each project has a work type associated with it, currently the Work Type
> column of the Project table holds the work type name, however i have now
> added a Work_Type_ID column to the Work_Type table and i would like Projects
> to hold the Work_Type_ID as opposed to the Work Type Name.
> 
> Thanks for your help
> 
> "Jeff Shapiro" <lists@nensha.com> wrote in message
> 20031004070753406637.GyazMail.lists@nensha.com">news:20031004070753406637.GyazMail.lists@nensha.com...
>> 
>>  It all depends on what database server (and version) you are using. I'm
>>  not really sure what you are asking, and could use a little more detail
>>  about the tables and what are needing to do.
>> 
>>  On Sat, 4 Oct 2003 13:45:56 +0100, Shaun spoke thusly about 
>>  Help With Another UPDATE Query Please!:
>>>  Hi,
>>> 
>>>  I am making some alterations to my Database. I have a table called
> projects
>>>  and a table called Work_Types. Projects currently contains the name of
> the
>>>  work type (Work_Type) but now I want to change this so it contains the
>>>  Work_Type_ID, is it possible to update Projects with one query?
>>> 
>>>  Thanks for your help
--
Listserv only address.
Jeff Shapiro

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux