professor1942
Senior member
I have a table in a database which has one field I need to update for all instances. My problem is the value of the field will be derived from other another field plus fields in two other tables, eg.
-----------------------------------------------------------
Table A contains:
Table B + Table C PK's (combined as PK for Table A)
quantity (int)
total_price (money) - this is the one that needs to be updated
Table B contains:
unit_price (money)
Table C contains:
shipping_charge (money)
-----------------------------------------------------------
total_price will be (quantity from Table A * unit_price from Table B) + shipping_charge from Table C. No problem for a SELECT statement, but how in hell do I UPDATE each total_price field with the calculations?
TIA
BTW I am using MS SQL Server 2005.
-----------------------------------------------------------
Table A contains:
Table B + Table C PK's (combined as PK for Table A)
quantity (int)
total_price (money) - this is the one that needs to be updated
Table B contains:
unit_price (money)
Table C contains:
shipping_charge (money)
-----------------------------------------------------------
total_price will be (quantity from Table A * unit_price from Table B) + shipping_charge from Table C. No problem for a SELECT statement, but how in hell do I UPDATE each total_price field with the calculations?
TIA
BTW I am using MS SQL Server 2005.