Help - Search - Members - Calendar
Full Version: Mysql Update
Linuxhelp > Support > Technical Support
Gruessle
I know this is easy for most of you but I been googling all over the place for help on this.

I have two tables and a text file
In the text file I have

products_model, products_description

The Tables look like this:
Table_1: products_id, products_model, etc. etc.
Table_2: products_id, products_description, etc. etc.

How can I UPDATE products_description in Table_2 WHERE products_model in Table_1 matches to the text file products_model.
hughesjr
You will need variable1 and variable2 passed in (probably from a from), I will assume that variable1 is the description and variable2 is the model ... the sql statement will look like this:

update Table_2 set Table_2.products_description = variable1 where Table_2.products_id = Table_1.products_id and Table_1.products_model = variable2;

(the above is all one line)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.