Hello, I have one table with the name dummy. In that table there is two columns I want to use, test1 which contains product ID's and test4 which contains prices. Then I have another table with the name products. In that table there amonh other columns two columns, one column with the name products_id with the products ids and another with the name products_prices which is the column I need to update with the prices from the test4 column in the dummy database. So I want to select the prices and products ids from the dummy table and update the prices in the products table. The products ids are the same in both tables and so is the number of lines. The only thing that differs is the prices, in the column test4 in the table dummy the real prices are and in the products table in the products_prices colum the wrong prices are that I want to update. The reason for wanting to to that is that all prices in the table my webshop uses has changed to zero... And that is not good, I can't give away all products : ) Thanks Oskar
I maybe should add that only the products with products_price = 0 in the products table needs to be updated.
I know that I think that PHP is useless but why on earth would you write any form of "program" to execute a single SQL query? UPDATE Products INNER JOIN Dummy ON Products.Products_ID = Dummy.Test1 SET Products.Products_Price = Dummy.Test4; Code (SQL): You may need to put `` around field names etc depending on which db you are using
I just like to prove to my developers that I can do a small amount of programming and not just a pretty face (aka project manager)