Updating records from other records in the same table

I have a table pricingmodels with a multi-field gridmasterid, gridrowid, gridcolid. I want to update all the rows for one gridmasterid/gridrowid combination with the values in the baseprice field for all the gridcolid values for they gridmasterid/gridrowid set.

What I have tried so far is

update pricingmodels as p1, (select baseprice, gridcolid from pricingmodels where gridmasterid = 1 and gridrowid = 1) as p2
					set p1.baseprice = p2.baseprice
                    where p1.gridmasterid = 2 and p1.gridrowid = 7 and p1.gridcolid = p2.gridcolid

and then what happened?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.