Question : DATABASE ROW UPDATE

I have two tables in a database called PCC_Cizelge and PCC_Firma

i want to update PCC_Cizelge's one column called company name with a column value in PCC_Firma

so what i want to do is for example

PCC_Cizelge                                                                     PCC_Firma
------------------                                                                 ---------------
row1 : company_name= Aksis                            row1:    Firma_No=3, Company_name='Aksis'


instead of value 'Aksis' in PCC_Cizelge I want to update it as '3' because Company_name in PCC_Firma Aksis has a ID=3 so there are 400 records what is the easy way to make that happen?

Answer : DATABASE ROW UPDATE

you cannot do like that indeed ...
http://www.experts-exchange.com/articles/Database/Miscellaneous/UPDATES-with-JOIN-for-everybody.html
mysql is unfortunately a bit limited in that regards, but you shall check out this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
Update inv i
SET i.total = ( select SUM(v.quantity * s.charges)
          from invitem v
          JOIN service s
             ON s.idservice = v.idservice
          WHERE v.datetime = i.datetime
            AND v.invoiceid = i.id  --- < I presume this link condition is missing also ...
       )
WHERE i.datetime = @uniquekey
Random Solutions  
 
programming4us programming4us