You are here: Re: Update one table field from another table field query? « PHP SQL « IT news, forums, messages
Re: Update one table field from another table field query?

Posted by MattMika on 07/27/06 17:17

On Wed, 26 Jul 2006 17:15:28 -0600, MattMika <mattmika@hotmail.com>
wrote:

>I recently changed the field length for products_model in our products
>table from varchar(12) to varchar(15) and failed to update that field
>in our orders_products table. So now I have incomplete model #'s in
>our orders_products table.
>
>I am unsure how to go about doing this in a query. Maybe something
>like this?:
>
>UPDATE orders_products SET products_model = (SELECT products_model
>from products)
>WHERE products.products_id = orders_products.products_id;
>
>Any suggestions would be greatly appreciated.
>TIA
>Matt Mika

I copied my tables and tested. Changed the above to:

UPDATE orders_products SET products_model = (SELECT products_model
from products WHERE products.products_id =
orders_products.products_id);

Worked like a charm...
Matt Mika

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация