Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Update command not working

Status
Not open for further replies.

emcounts

IS-IT--Management
Jun 4, 2001
1
US
I need to update the price in one table from a field in another.

2 Tables named:
newpricelist
pricelist

I have 3 common fields in both, item, description and price. I need to match the item field and take the price from "newpricelist" table and update the price field in the "pricelist" table.

Here is my syntax (it says it will only update 1 record):
UPDATE PRICELIST INNER JOIN NEWPRICELIST ON NEWPRICELIST.ITEM = PRICELIST.ITEM SET PRICELIST.PRICE = NEWPRICELIST.PRICE;

Thank you for your help!
 
UPDATE PRICELIST, NEWPRICELIST
SET PRICELIST.PRICE = NEWPRICELIST.PRICE
WHERE NEWPRICELIST.ITEM = PRICELIST.ITEM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top