SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Need help with an update
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cgcourson
Starting Member

3 Posts

Posted - 01/31/2013 :  16:47:27  Show Profile  Reply with Quote
I am familiar with updates on one table but not when data spans two tables, so any help would be greatly appreciated.

I have a spreadsheet with pricing by model number and I need to update a pricing table in the database...here is the problem..

In the DB, my products_tbl has a product_id and a product_model

the table I need to update (products_groups) only has the product_id and price so the update query I need to write needs to find the products_id for a products_model then update the price.

I will need to do this on 20,000+ rows so will need to concatenate in SQL which is no problem, but the query will be difficult for me. sorry if explanation is a little difficult to understand

THanks in advance to whomever can lend a hand
Chris

sodeep
Flowing Fount of Yak Knowledge

USA
7174 Posts

Posted - 01/31/2013 :  20:21:18  Show Profile  Reply with Quote
Dump ExcelSheet into TempTable. If you need to do regularly you can do through SSIS Package

Update pg
Set pg.Price = T.Price
from Product_tbl pd
inner join Temptable T on T.product_model = pd.product_model
inner join products_groups pg on pg.product_id = pd.product_id
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000